overiding assignment in module

2005-10-25 Thread Viktor Marohnic
Hello. I would to do something like this. container = [] p1 = point() l1 = line() and i would like to override = method of the module so that its puts all objects into container. how i can do something like that. thanks for help, viktor. -- http://mail.python.org/mailman/listinfo/python-list

Re: overiding assignment in module

2005-10-25 Thread Fredrik Lundh
Viktor Marohnic wrote: I would to do something like this. container = [] p1 = point() l1 = line() and i would like to override = method of the module so that its puts all objects into container. how i can do something like that. you cannot, at least not as you've described the problem.

Re: overiding assignment in module

2005-10-25 Thread Steven D'Aprano
On Tue, 25 Oct 2005 04:56:02 -0700, Viktor Marohnic wrote: Hello. I would to do something like this. container = [] p1 = point() l1 = line() Choosing names that look like numbers is terrible practice. Don't use l, l1, O, ll, and so forth, unless you are trying to deliberately make your

Re: overiding assignment in module

2005-10-25 Thread Viktor Marohnic
Ok thanks a lot. I think i got the point. I also thought that it could be possible to do something like this globals().__setitem__ = custom_setter but __setitem__ is readonly -- http://mail.python.org/mailman/listinfo/python-list