Follow

My PyTexas talk, "What to Do When the Bug is in Someone Else's Code" will be streaming in 15 minutes!

I'll be in the Youtube chat answering questions and "not really a question, more of a comment"s!

Link to stream:

youtube.com/watch?v=S4TjOnkFLt

Talk is done!

The video is available here if you missed it (with an archive of the chat): youtu.be/S4TjOnkFLtI

Slides (with speaker notes) are here: pganssle-talks.github.io/pytex

The slides are probably not especially mobile-friendly.

@pganssle pretty stumped packages and classes in them aren't locked down after the package is created. Now if it says `math.pi` the interpreter has to look it up every time, as opposed to going "right this is constant, plop".. And if it is known it is possible to actually reason about it..

@jasper Some classes and objects can be made immutable (or, at least, immutable enough), but it's certainly not the default.

At the end of the day, I think the ability to monkey patch modules and classes is a net benefit. Everyone knows that it's a code smell, so it's not done widely, but the fact that you can do it allows you to avoid some other even worse patterns.

I just had a thread about this, actually: qoto.org/@pganssle/10510754410

@jasper I do think it's the sort of thing that hurts our ability to write optimizing compilers and such without modifying semantics. It's hard to do constant folding and such when the "constant" is actually an attribute on a mutable object (and may even be dynamically returned, see PEP 562: python.org/dev/peps/pep-0562/)

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.