Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-26 Thread Simon Forman
On Mon, Oct 26, 2009 at 12:04 AM, rh0dium wrote: [snip] > > > Now the real question I have on this is scalability.  The real What you're describing isn't "scalability". It could be called "extensibility". > advantage to using *args and **kwargs is that down the road (through > inheritance/polym

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-25 Thread Carl Banks
On Oct 25, 9:04 pm, rh0dium wrote: > On Oct 22, 9:05 pm, Carl Banks wrote: > > This should suffice for you: > > > class Borg(object): > >     __shared_state = {} > >     def __init__(self, noSend=False,reportLevel=30, > >                  reportMethods="BaseReport", > >                  contacts=

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-25 Thread rh0dium
Carl, First off - Thanks your post was exactly the kind of informative example driven learnings that help — Thanks!! On Oct 22, 9:05 pm, Carl Banks wrote: > > Before we get into object semantics, I'm not sure why you'd need to > override __new__ for Borg pattern, unless they're working around

Re: Python 2.6 Deprecation Warnings with __new__ Can someone explain why?

2009-10-24 Thread Dieter Maurer
Terry Reedy writes on Fri, 23 Oct 2009 03:04:41 -0400: > Consider this: > > def blackhole(*args, **kwds): pass > > The fact that it accept args that it ignores could be considered > misleading or even a bug. Maybe, it could. But, it is by no means necessary. In mathematics, there is a set of i

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Stephen Hansen
On Thu, Oct 22, 2009 at 9:09 PM, Stephen Hansen wrote: > >>> class myclass(object): > ... def __new__(cls, *args, **kwargs): > ... print args > ... print kwargs > ... self = object.__new__(cls) > ... return self > ... def __init__(self, *args

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Carl Banks
On Oct 22, 8:12 pm, rh0dium wrote: > Hi all, > > I have a basic Monostate with Python 2.6. > > class Borg(object): >     __shared_state = {} >     def __new__(cls, *args, **kwargs): >         self = object.__new__(cls, *args, **kwargs) >         self.__dict__ = cls.__shared_state >         return

Re: Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread Stephen Hansen
On Thu, Oct 22, 2009 at 8:12 PM, rh0dium wrote: > In my case the args that it dumps them into a black hold is simply not > true. I want an unknown set of args and kwargs to simply be forwarded > onto init. So what's the problem with this?? > There is no problem with doing that-- the deprecatio

Python 2.6 Deprecation Warnings with __new__ — Can someone explain why?

2009-10-22 Thread rh0dium
Hi all, I have a basic Monostate with Python 2.6. class Borg(object): __shared_state = {} def __new__(cls, *args, **kwargs): self = object.__new__(cls, *args, **kwargs) self.__dict__ = cls.__shared_state return self def __init__(self, *args, **kwargs):

Re: can someone explain why this happens- newbie question

2008-09-30 Thread Almar Klein
change: for score in scores: print scores to: for score in scores: print score that should do the trick :) Almar 2008/9/30 garywood <[EMAIL PROTECTED]> > Hi > can someone tell me why it prints the high score table multiple times? > > #high scores program > scores =[] > choice = None > >

can someone explain why this happens- newbie question

2008-09-30 Thread garywood
Hi can someone tell me why it prints the high score table multiple times? #high scores program scores =[] choice = None while choice != 0: print """high Score Table 0 - exit 1 - show Scores 2 - add a score 3 - delete a score 4 - sort scores """

Re: can someone explain why ..

2006-04-25 Thread Grant Edwards
On 2006-04-25, Schüle Daniel <[EMAIL PROTECTED]> wrote: >> I'm not familiar with Tkinter, but it seems as thought with 2, >> the "image" variable is garbage collected after the >> constructor of Main is called. With 1, you save a reference to >> the image, so it does not get garbage collected. Co

Re: can someone explain why ..

2006-04-25 Thread Grant Edwards
On 2006-04-25, Farshid Lashkari <[EMAIL PROTECTED]> wrote: > Schüle Daniel wrote: >> I don't understand what is the difference between commented lines >> 1 and 2 >> >> with 1 uncommented and 2 commented it works as expected >> with 1 commented and 2 uncommented the picture doesn't appear > > > I'm

Re: can someone explain why ..

2006-04-25 Thread Schüle Daniel
[..] > These are the only lines of code that reference "imageLabel": > > imageLabel = Label(master = frame1, image = image) > imageLabel.pack() > > > Unless the constructor of Label adds a reference of itself to frame1, > imageLabel will also become garbage collected at the end of the > const

Re: can someone explain why ..

2006-04-25 Thread Farshid Lashkari
Schüle Daniel wrote: > thx for quick reply :) > > image is local variable of imageLabel > I would expect that in case imageLabel lives, it should > hold alife objects bound to its local variables > > I am just curious *why* reference to image is not hold by imageLabel > which on his part is hold

Re: can someone explain why ..

2006-04-25 Thread Schüle Daniel
Farshid Lashkari schrieb: > Schüle Daniel wrote: >> I don't understand what is the difference between commented lines >> 1 and 2 >> >> with 1 uncommented and 2 commented it works as expected >> with 1 commented and 2 uncommented the picture doesn't appear > > > I'm not familiar with Tkinter, but

Re: can someone explain why ..

2006-04-25 Thread Farshid Lashkari
Schüle Daniel wrote: > I don't understand what is the difference between commented lines > 1 and 2 > > with 1 uncommented and 2 commented it works as expected > with 1 commented and 2 uncommented the picture doesn't appear I'm not familiar with Tkinter, but it seems as thought with 2, the "imag

can someone explain why ..

2006-04-25 Thread Schüle Daniel
I don't understand what is the difference between commented lines 1 and 2 with 1 uncommented and 2 commented it works as expected with 1 commented and 2 uncommented the picture doesn't appear here is my code #!/usr/bin/env python from Tkinter import * from Tkconstants import * root = None cla