
On 7/13/07, Neil Toronto <ntoronto@cs.byu.edu> wrote:
On a very related topic, I find it interesting how often classes get abused just to provide a convenient namespace to stick things in. Classes are heavy things, though, with a lot of semantics and behind-the-scenes witchery to deal with inheritance and metaclasses and such-like. Why bring that baggage into it? It might be nice to be able to declare a one-off namespace:
class Foo: x: '''documentation''' def __get__(self, instance, owner): # self = x, instance = a Foo(), owner = Foo() return instance._x
logger: '''Singleton logger object blah blah...''' db = make_db_connection(...)
def log(self, message): ...
You should look at the "make" statement PEP, which offered you something like this: http://www.python.org/dev/peps/pep-0359/ It was withdrawn at Guido's request - partly because he didn't like how it allowed you to indent the methods for properties. STeVe -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy