Hi, you can use __slots__ in python class, which offically do optimization
(masking and sort of memory management )as it will only allow attributes with
certain names for the class.
Eg.
class Foo:
__slots__ = ['a', 'b']
def __init__(self, n):
self.a = n
bar = Foo('py')
print bar.a # py
bar.pretty = 4 # Throws exception.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.