A field annotation describes an intended type; it does not automatically reject a different runtime value. A dataclass can generate a useful constructor while still accepting a string where the annotation says int. The Python dataclasses reference describes the generated initializer and its call to post_init. This example adds one deliberately... Weiterlesen: Put Runtime Checks in a Dataclass Post-Init Hook
Intelligence View
⚡ tsecurity.de Intelligence
Put Runtime Checks in a Dataclass Post-Init Hook
A field annotation describes an intended type; it does not automatically reject a different runtime value. A dataclass can generate a useful constructor while…
Quelle & Fakten · 1 Min. Lesezeit
Quelle: DEV Community (dev.to)
Rubrik: Secure Programming
Information ergänzen Fachhinweis, Update, Korrektur oder Quelle zur Meldung beitragen
Community-Hinweise zur Meldung
Security Briefing Free · 1-Click Unsubscribe
Intelligence Digest — free
The top security news daily · unsubscribe anytime
💬 Community discussion & comments
Start the discussion in the Social Chat broadcast stream or submit an expert contribution via the supplement form above.