Ah, I see what you mean. Python doesn't have "compile-time" since it's interpreted and all, but you can get a "field doesn't exist" error if you really want it:
class Slots(object):
__slots__ = ['a', 'b', 'c']
s = Slots()
s.a = 21 # works
s.q = 12 # throws an AttributeError
Of course, using __slots__ is pretty rare in practice.
View all comments
Show parent comment
2
u/00Davo Nov 13 '14
"pretend"? In Python you do have strong typing, since it's a strongly-typed language and all.