Crell,
@Crell@phpc.social avatar

Teaching folks the joys of clear and explicit object type definitions. An interesting experience...

ramsey,
@ramsey@phpc.social avatar

@Crell I don’t even know how you do that in Python.

Crell,
@Crell@phpc.social avatar

@ramsey

  1. Python has types, they're just elided. Basically just documentation, but use 'em.
  2. Python has @dataclass definitions, and an extension library called Pydantic that's pretty nice.
  3. Lean hard on "if you have a dict where you know the types in advance, make it a class." (Python version of "Never* Use Arrays".)

It's... more capable in this regard than I expected, honestly.

ramsey,
@ramsey@phpc.social avatar

@Crell Since they’re elided, does the community have a universally agreed upon analyzer that everyone uses, like with TypeScript?

In other words, if I use types in my library, can I be certain they will prevent users of my library from making type mistakes with it?

Crell,
@Crell@phpc.social avatar

@ramsey I'm not sure. I'm just relying on my IDE. 🤷‍♂️

Girgias,
@Girgias@phpc.social avatar

@ramsey @Crell The only one I know is FB's one, Pysa, in which they took the lesson learned from Zoncolan (like taint analysis, whose white paper @psalm used).

But I'm guessing there are some competing one.

https://engineering.fb.com/2020/08/07/security/pysa/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • kavyap
  • InstantRegret
  • khanakhh
  • ngwrru68w68
  • osvaldo12
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • everett
  • Youngstown
  • slotface
  • rosin
  • GTA5RPClips
  • JUstTest
  • Durango
  • cubers
  • modclub
  • tester
  • tacticalgear
  • cisconetworking
  • ethstaker
  • anitta
  • Leos
  • megavids
  • normalnudes
  • provamag3
  • lostlight
  • All magazines