super() in class defs?

2011-05-25 Thread Jess Austin
I may be attempting something improper here, but maybe I'm just going about it the wrong way. I'm subclassing http.server.CGIHTTPRequestHandler, and I'm using a decorator to add functionality to several overridden methods. def do_decorate(func): . def wrapper(self): . if appropriate(): .

Re: Do any debuggers support "edit and continue?"

2010-05-12 Thread Jess
Cheap Chanel Watches for sale at: http://www.luxuryowner.net/ Chanel Watches collection: http://www.luxuryowner.net/replica-chanel-watches.html Chanel J12 Automatic Watches: http://www.luxuryowner.net/Chanel-J12-Automatic-Watches.html Chanel J12 Quartz Watches: http://www.luxuryowner.net/Chan

Re: How to test whether bit is set within a flag with Python ?

2010-05-12 Thread Jess
Cheap Chanel Watches for sale at: http://www.luxuryowner.net/ Chanel Watches collection: http://www.luxuryowner.net/replica-chanel-watches.html Chanel J12 Automatic Watches: http://www.luxuryowner.net/Chanel-J12-Automatic-Watches.html Chanel J12 Quartz Watches: http://www.luxuryowner.net/Chan

Re: __eq__() inconvenience when subclassing set

2009-11-02 Thread Jess Austin
ozenset() True I doubt that either of these invariants is amenable to modification, even for purposes of "consistency". I'm not sure how to resolve this, but you've definitely helped me here. Perhaps the test in set_richcompare can return NotImplemented in particular cases but not in others? I'll think about this; let me know if you come up with anything more. thanks, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: __eq__() inconvenience when subclassing set

2009-10-30 Thread Jess Austin
It may be best not to sully such generalized code with a special case for this. I may do some experiments with bytes, str, and unicode, since that seems to be an analogous case. There is a basestring type, but at this point I don't know that it really helps with anything. cheers, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: __eq__() inconvenience when subclassing set

2009-10-29 Thread Jess Austin
On Oct 29, 3:54 pm, Mick Krippendorf wrote: > Jess Austin wrote: > > That's nice, but it means that everyone who imports my class will have > > to import the monkeypatch of frozenset, as well.  I'm not sure I want > > that.  More ruby than python, ne? > > I t

Re: __eq__() inconvenience when subclassing set

2009-10-29 Thread Jess Austin
  return True >         return super(eqmixin, self).__eq__(other) > > class frozenset(eqmixin, frozenset): >     pass That's nice, but it means that everyone who imports my class will have to import the monkeypatch of frozenset, as well. I'm not sure I want tha

__eq__() inconvenience when subclassing set

2009-10-28 Thread Jess Austin
d. If it matters, I'm using 2.6, but I can change versions if it will help. Should I give up on this, or is there something else I can try? Keep in mind, I must redefine __eq__(), and I'd like to be able to compare instances of the class to both set and frozenset instances. cheers, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: generators shared among threads

2006-03-09 Thread jess . austin
hon? I started the discussion with simpler versions of these same questions. I'm convinced that using Queue is safe, but now I'm not convinced that just using a generator is not safe. cheers, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: generators shared among threads

2006-03-08 Thread jess . austin
I just noticed, if you don't define maxsize in _init(), you need to override _full() as well: def _full(self): return False cheers, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: generators shared among threads

2006-03-07 Thread jess . austin
Paul wrote: >def f(): >lock = threading.Lock() >i = 0 >while True: >lock.acquire() >yield i >i += 1 >lock.release() > > but it's easy to make mistakes when implementing things like that > (I'm not even totally confident tha

Re: generators shared among threads

2006-03-07 Thread jess . austin
Alex wrote: > Last, I'm not sure I'd think of this as a reentrantQueue, so > much as a ReentrantCounter;-). Of course! It must have been late when I named this class... I think I'll go change the name in my code right now. -- http://mail.python.org/mailman/listinfo/python-list

Re: generators shared among threads

2006-03-06 Thread jess . austin
Thanks for the great advice, Alex. Here is a subclass that seems to work: from Queue import Queue from itertools import count class reentrantQueue(Queue): def _init(self, maxsize): self.maxsize = 0 self.queue = [] # so we don't have to override put() self.counter =

Re: Easy immutability in python?

2006-03-04 Thread jess . austin
ty of the interlocutors. To summarize: first post is a use case, second post is an implementation of that use case, and subsequent posts alternate between "that's not how I want to do it" and "please provide a more specific use case for which the provided implementation is not

Re: do design patterns still apply with Python?

2006-03-04 Thread jess . austin
msoulier wrote: > I find that DP junkies don't tend to keep things simple. +1 QOTW. There's something about these "political" threads that seems to bring out the best quotes. b^) -- http://mail.python.org/mailman/listinfo/python-list

generators shared among threads

2006-03-04 Thread jess . austin
the yield statement. thanks, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy immutability in python?

2006-03-04 Thread jess . austin
then that processing should take place in a.__new__. cheers, Jess -- http://mail.python.org/mailman/listinfo/python-list

Re: Easy immutability in python?

2006-03-04 Thread jess . austin
Since this is a container that needs to be "immutable, like a tuple", why not just inherit from tuple? You'll need to override the __new__ method, rather than the __init__, since tuples are immutable: class a(tuple): def __new__(cls, t): return tuple.__new__(cls, t

Re: Pulling all n-sized combinations from a list

2006-02-17 Thread jess . austin
d)) for a in alph for b in alph for c in alph for d in >>> alph ... if (a!=b and b!=c and c!=d and d!=a and b!=d and a!=c)]) 358800 >>> len([''.join((a,b,c,d)) for a in alph for b in alph for c in alph for d in >>> alph ... if (a>b and b>c and c>d)]) 14950 cheers, Jess -- http://mail.python.org/mailman/listinfo/python-list