Hi, I'm coming in from a despised Java background, and I'm having some 
trouble wrapping my head around sharing an object between multiple 
instances of a single class (in simpler terms, I would say imagine a 
simple chat server that has to share a list of connected users to each 
instance of a connected user).

Usually, I would have a synchronized list instantiated inside each 
instance of a client class, which would do the trick, but since there's 
no synchronization in Python, I'm stuck staring at little tests 
involving a standalone non-threaded class instance that holds the list 
of users, and each connected user being passed this instance to be 
"synchronized".

Now, whilst this *works*, it just doesn't feel right, and I would 
appreciate it if anyone has any more Pythonic expressions of this paradigm.

Note that I have looked at Twisted (and I use it for other stuff), but 
I'm wanting to do things at a lower level (because I'm masochistic), and 
I feel like all the fun has been sucked out of programming by basically 
telling Twisted what I want and have it do it for me invisibly.

Thanks!


~Chris

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to