Re: How to isolate a constant?

2011-10-22 Thread Steven D'Aprano
On Sat, 22 Oct 2011 18:01:52 -0700, Gnarlodious wrote: > On Oct 22, 6:41 pm, Chris Rebert wrote: > >> The line `someList = self._someList` does NOT copy the list. It make >> `someList` point to the same existing list object. > Thanks for all those explanations, I've already fixed it with a tuple

Re: How to isolate a constant?

2011-10-22 Thread 88888 Dihedral
Thank you for the good trick for a static class owned property. Someone might object this but this is really useful. -- http://mail.python.org/mailman/listinfo/python-list

Re: compare range objects

2011-10-22 Thread rusi
On Oct 22, 10:51 pm, SigmundV wrote: > On Oct 22, 6:32 am, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > > > Sure. But the downside of sets is that, like lists, they are not lazy, > > Thank you for pointing this out. I agree that it's not a viable > alternative for large domains. St

Exception Handling (C - extending python)

2011-10-22 Thread Lee
Hi all, Where does PyExc_TypeError (and alike) points to? I can see its declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerrors.h but I cannot figure out what it is its value, where it is initialized. Any help is greatly appreciated. Lee -- http://mail.python.org/mailman/listinfo/py

Re: How to isolate a constant?

2011-10-22 Thread Gnarlodious
On Oct 22, 6:41 pm, Chris Rebert wrote: > The line `someList = self._someList` does NOT copy the list. It make > `someList` point to the same existing list object. Thanks for all those explanations, I've already fixed it with a tuple. Which is more reliable anyway. -- Gnarlie -- http://mail.pyt

Re: How to isolate a constant?

2011-10-22 Thread MRAB
On 23/10/2011 01:26, Gnarlodious wrote: Say this: class tester(): _someList = [0, 1] def __call__(self): someList = self._someList someList += "X" return someList test = tester() But guess what, every call adds to the variable tha

Re: How to isolate a constant?

2011-10-22 Thread Chris Rebert
On Sat, Oct 22, 2011 at 5:26 PM, Gnarlodious wrote: > Say this: > > class tester(): Style note: either have it explicitly subclass `object`, or don't include the parens at all. Empty parens for the superclasses is just weird. >        _someList = [0, 1] >        def __call__(self): >            

How to isolate a constant?

2011-10-22 Thread Gnarlodious
Say this: class tester(): _someList = [0, 1] def __call__(self): someList = self._someList someList += "X" return someList test = tester() But guess what, every call adds to the variable that I am trying to copy each time: test() >

Books to lean Python 3 Web Programming?

2011-10-22 Thread Jonathan Loescher
Can anyone recommend a good book to learn the web programming aspects of Python 3? -- http://mail.python.org/mailman/listinfo/python-list

Re: compare range objects

2011-10-22 Thread SigmundV
On Oct 22, 6:32 am, Steven D'Aprano wrote: > > Sure. But the downside of sets is that, like lists, they are not lazy, Thank you for pointing this out. I agree that it's not a viable alternative for large domains. Storing the bounds and the resolution should be enough. /Sigmund -- http://mail.py

Re: help

2011-10-22 Thread Steven D'Aprano
On Sat, 22 Oct 2011 15:16:47 +0200, Matej Cepl wrote: > On Oct 8, 2:51 pm, X1 wrote: >> >> easy_install does not exist on Fedora. > > That's a pure lie. Rather than assume malice, we should give X1 the benefit of the doubt and assume he genuinely believed what he wrote but was merely mistaken.

Re: help

2011-10-22 Thread Matej Cepl
On Oct 8, 2:51 pm, X1 wrote: easy_install does not exist on Fedora. That's a pure lie. mitmanek:~ $ sudo repoquery -qf /usr/bin/easy_install python-setuptools-0:0.6.10-3.el6.noarch mitmanek:~ $ Matěj -- http://mail.python.org/mailman/listinfo/python-list

Re: compare range objects

2011-10-22 Thread Steven D'Aprano
On Sat, 22 Oct 2011 05:32:44 +, Steven D'Aprano wrote: > On Fri, 21 Oct 2011 16:42:16 -0700, SigmundV wrote: > >> On Oct 21, 2:55 am, Yingjie Lan wrote: >>> >>> In simulation, one can use range objects to denote a discrete domain, >>> and domain comparison could be very useful. Not just equa

shutil _isindir

2011-10-22 Thread David Hoese
I was about to submit a bug report, but while testing I have figured out that my specific problem has been solved in Python 2.7 (server that I was using had 2.6 on it). You can see the differences here: 2.6: http://hg.python.org/cpython/file/b9a95ce2692c/Lib/shutil.py 2.7: http://hg.python.org

logging: warn() methods and function to be deprecated.

2011-10-22 Thread Vinay Sajip
In response to an issue (#13235) raised on the Python bug tracker, I'm going to deprecate the warn() methods in the Logger and LoggerAdapter classes in the stdlib logging package, as well the module-level warn() function. The warn() variants were synonyms for the warning() methods and function, an

Re: revive a generator

2011-10-22 Thread Carl Banks
On Thursday, October 20, 2011 6:23:50 AM UTC-7, Yingjie Lan wrote: > Hi, > > it seems a generator expression can be used only once: > > >>> g = (x*x for x in range(3)) > >>> for x in g: print x > 0 > 1 > 4 > >>> for x in g: print x #nothing printed > >>> > > Is there any way to revive g here? R

Re: shutil _isindir

2011-10-22 Thread Steven D'Aprano
On Fri, 21 Oct 2011 22:13:06 -0500, David Hoese wrote: > So I guess what I'm asking is what are the reasons that _destinsrc uses > abspath instead of realpath? And is there a better place to ask this? Probably because abspath goes back to Python 1.5, while realpath is comparatively recent only

Re: shutil _isindir

2011-10-22 Thread Peter Otten
David Hoese wrote: > I wasn't really sure where to post this since the python-dev list seems > way too official. I'm wondering/questioning the behavior of > shutil.move. It currently does a check for if the dst is inside the src > directory with a _destinsrc function. This function uses > os.pa