Vai al contenuto principale
ProdottiStrumenti desktopTASTECADVisualizzazione disegniTASTEFILESGestione fileTASTEFTPTrasferimento fileTASTESSHSpazio di lavoro remotoTASTEZIPCompressione ed estrazioneTASTEWINMGestione fileStrumenti per sviluppatoriTASTECODEAmbiente di sviluppo integrato per RustTASTESTUDIOAmbiente integrato di sviluppo e testTASTEETLIntegrazione dati (ETL)ServerTASTEREMOTEServer di desktop remotoTASTEGEOServer geospazialeTASTEMAILSpazio di lavoro emailInvestimentiTASTESTOCKApp desktop di trading automatico azionarioIniziaDownloadDocumentazioneAcquistaTutti i prodotti
Marketplace
Notizie
TecnologiaNotizieNotizie di sviluppo di oggiDocumentazioneLinguaggi di programmazioneRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFramework frontend webNext.jsReactVue.js · NuxtSvelteKitAngularFramework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFramework per app e desktopTauriFlutterReact NativeElectronAlgoritmiBasi degli algoritmiAlgoritmi fondamentaliAlgoritmi avanzatiAlgoritmi pratici
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrinaGuida alla community
CollaboraTrasferimento tecnicoRealizzazione del sito webRealizzazione di app desktopPipeline di rilascio e pagamentoPartner commercialeContatti
ServiziDesktop remotoPacchetti di installazione su misura
TASTEDEV
Prodotti

Strumenti desktop

TASTECADApri con leggerezza anche i disegni più complessiTASTEFILESSolo i file che servono, alla massima velocitàTASTEFTPLa via più ordinata per i tuoi fileTASTESSHUn legame più solido tra te e i tuoi serverTASTEZIPComprimi più veloce, estrai più sicuroTASTEWINMUn file manager a due pannelli pensato per la tastiera

Strumenti per sviluppatori

TASTECODEModifica, compila, esegui il debug e testa app Rust in un'unica finestraTASTESTUDIODalla modifica ai test remoti e alle correzioni IA approvateTASTEETLSposta i dati guardando i valori

Server

TASTEREMOTEUn desktop remoto che gira sul tuo serverTASTEGEOUn server geospaziale compatibile con GeoServer, ricostruito in RustTASTEMAILRiprendi il controllo della tua posta

Investimenti

TASTESTOCKTrading automatico azionario secondo le regole che decidi tu: quando e che cosa

Inizia

DownloadUltime versioni di ogni prodottoDocsCome usare ogni prodottoAcquistaAbbonamenti e licenze perpetueTutti i prodottiTutti i prodotti a colpo d’occhio
Tutti i prodotti
MarketplaceNotizie
Tecnologia

Notizie

Notizie di sviluppo di oggiAnnunci ufficiali su linguaggi, framework, GitHub e IADocumentazioneGuide a linguaggi, framework e algoritmi

Linguaggi di programmazione

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Framework

Framework frontend webNext.jsReactVue.js · NuxtSvelteKitAngular
Framework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Framework per app e desktopTauriFlutterReact NativeElectron

Algoritmi

Basi degli algoritmiAnalisi della complessità · Ordinamento · Ricerca · Strutture dati di base · Alberi e heapAlgoritmi fondamentaliVisita dei grafi · Cammini minimi e alberi ricoprenti · Programmazione dinamica · Algoritmi greedy · Divide et impera · BacktrackingAlgoritmi avanzatiAlgoritmi sulle stringhe · Matematica e teoria dei numeri · Manipolazione dei bit · Alberi di segmenti · Union-FindAlgoritmi praticiStrategia per colloqui di programmazione · Cache LRU · Rate limiting · Hashing consistente
Tutta la documentazione di sviluppo
Community
ProgettiScopri sviluppatori e lavoriLog di sviluppoDecisioni e lezioni appresePromptIstruzioni riutilizzabiliProblemi degli strumenti di IAProblemi e alternative di Claude, Codex, GeminiVetrinaRisultati completatiGuida alla communityCome sviluppiamo in modo aperto
Collabora
Trasferimento tecnicoApp native in Rust ed eguiRealizzazione del sito web10 lingue, account, documentazione e downloadRealizzazione di app desktopRust ed egui, senza WebViewPipeline di rilascio e pagamentoFirma, MSI, deb, rpm, AppImage, hashPartner commercialeConsigliaci e ricevi il 30%ContattiSviluppo, partnership e investimenti
Servizi
Desktop remotoRaggiungi il tuo computer dal browserPacchetti di installazione su misuraSolo il necessario, impostazioni precaricate
Acquista
IT
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Accedi
Accedi
TASTEDEV

Dai piccoli strumenti a uno sviluppo migliore.

support@tastedev.netSostieni TASTEDEV
ProdottiGamma di prodottiAcquistaDocsDownloadMarketplaceAssistenza
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrina
NormeChi siamoInformativa sulla privacyTermini di servizioCondizioni di abbonamentoRimborsiLinee guida della community
AccountAccediRegistrati
Visitatori
Oggi
Ieri
Visualizzazioni totali
Società
GXSOFT
Rappresentante
CHOI YOUNG GU
Numero di registrazione
853-44-00368
Indirizzo
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefono
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsabile privacy
CHOI YOUNG GU

© 2026 TASTEDEVLe informazioni sui prodotti si basano su fonti di sviluppo verificate.Rilasciato · in miglioramento

Documentazione di Python
Python
Getting StartedSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts
Discussioni

Guida a Python · 3/6

Types and Data

Per ora questo capitolo è disponibile solo in inglese.

Python ships with a small set of core types and four built-in collections that cover most day-to-day data handling. This chapter shows when to reach for each one, how to define your own types with classes and dataclasses, and how type hints make intent explicit without changing how code runs.

Core types

TypeExamplesNotes
int42, 1_000_000Integers of unlimited size
float3.14, 1e-3Double-precision floating point
str"hello", 'text'Immutable Unicode text
boolTrue, FalseBooleans
NoneNoneThe single value meaning "nothing here"
7 / 2      # 3.5  (true division always gives a float)
7 // 2     # 3    (floor division)
7 % 2      # 1    (remainder)
2 ** 100   # big integers are exact, no overflow

text = "Python"
text[0]        # 'P'
text[-1]       # 'n'
text[1:4]      # 'yth'  (slicing)
"py" in text.lower()  # True

value = None
if value is None:      # compare with None using is, not ==
    print("no value")

Empty strings, zero, empty collections and None are all falsy. That is why if items: reads naturally as "if the list has anything in it".

Collections

The four built-in collections each have a clear job:

  • list: an ordered, mutable sequence. The workhorse.
  • tuple: ordered but immutable. Good for fixed groupings such as coordinates or multiple return values.
  • dict: a mapping from keys to values. It remembers insertion order.
  • set: an unordered collection of unique values, with fast membership tests and set algebra.
nums = [3, 1, 2]
nums.append(4)
nums.sort()             # [1, 2, 3, 4]

point = (10, 20)
x, y = point            # tuple unpacking

ages = {"mina": 31, "joon": 28}
ages["sara"] = 25
ages.get("tom", 0)      # 0 when the key is missing
for name, age in ages.items():
    print(name, age)

tags = {"python", "web", "python"}
tags                    # {'python', 'web'}
tags & {"web", "api"}   # {'web'}  (intersection)

Lists and dicts are mutable, and assignment never copies. Two names can refer to the same list, so a change through one is visible through the other. Make an explicit copy with or when you need independence.

Domande su questo capitolo?
Capitolo precedenteSyntax BasicsCapitolo successivoModules and Packages
nums.copy()
dict(ages)

Classes and dataclasses

Define a class with class. The __init__ method initializes new instances, and every method receives the instance itself as its first parameter, conventionally named self.

class Account:
    def __init__(self, owner: str, balance: int = 0) -> None:
        self.owner = owner
        self.balance = balance

    def deposit(self, amount: int) -> None:
        if amount <= 0:
            raise ValueError("amount must be positive")
        self.balance += amount

    def __repr__(self) -> str:
        return f"Account({self.owner!r}, {self.balance})"


acc = Account("mina")
acc.deposit(100)
print(acc)   # Account('mina', 100)

When a class mostly exists to hold data, the standard dataclasses module removes the boilerplate. List the fields with type hints and you get __init__, __repr__ and __eq__ generated for you. Pass frozen=True to make instances immutable.

from dataclasses import dataclass, field


@dataclass
class Order:
    id: int
    customer: str
    items: list[str] = field(default_factory=list)
    paid: bool = False


@dataclass(frozen=True)
class Point:
    x: float
    y: float


order = Order(1, "mina")
order.items.append("book")
print(order)                       # Order(id=1, customer='mina', items=['book'], paid=False)
Point(1, 2) == Point(1, 2)         # True

Type hints

Python is dynamically typed, but you can annotate variables, parameters and return values. The interpreter does not enforce these hints at runtime; instead editors use them for completion, and static checkers such as mypy and Pyright use them to catch mistakes before the code ever runs. The payoff grows with the size of the codebase.

from typing import Optional


def find_user(users: dict[str, int], name: str) -> int | None:
    return users.get(name)


def average(values: list[float]) -> float:
    return sum(values) / len(values) if values else 0.0


scores: list[int] = [90, 85]
lookup: dict[str, tuple[int, int]] = {"origin": (0, 0)}
maybe: Optional[str] = None   # same as str | None
python -m pip install mypy
mypy app.py

Summary

  • The core types are int, float, str, bool and None; test for None with is.
  • Pick list for changing sequences, tuple for fixed groups, dict for lookups and set for uniqueness.
  • Use classes for objects with behavior and @dataclass for plain data containers.
  • Type hints do not change runtime behavior, but editors and checkers turn them into early bug detection.

0 commenti

Commenti principaliPrima i più recenti

Accedi · Accedi per lasciare un commento.