Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Nobody
On Fri, 01 Mar 2013 17:24:05 +0800, Honghe Wu wrote: > Thanks! Cause I need sorted returnd list, and the arbitrary list makes the > other procedure go wrong. Maybe the I/O speed is more important in other > cases. You can sort the lists of files and subdirectories with e.g.: for root, di

Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Honghe Wu
Thanks! Cause I need sorted returnd list, and the arbitrary list makes the other procedure go wrong. Maybe the I/O speed is more important in other cases. On Mar 1, 2013 4:55 PM, "Chris Rebert" wrote: > On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu wrote: > > env: python 2.7.3 > > > > 6 test files'

Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Chris Rebert
On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu wrote: > env: python 2.7.3 > > 6 test files' name in a directory as below: > 12ab Abc Eab a1bc acd bc > > the following is test code: > for root, dirs, files in os.walk(os.getcwd()): > print files > > the output in win32 platform is: > ['12ab', '

Re: In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Benjamin Kaplan
On Fri, Mar 1, 2013 at 12:43 AM, Honghe Wu wrote: > env: python 2.7.3 > > 6 test files' name in a directory as below: > 12ab Abc Eab a1bc acd bc > > the following is test code: > for root, dirs, files in os.walk(os.getcwd()): > print files > > the output in win32 platform is: > ['12ab', '

In win32 and linux platform, os modules has diffreent output order, is it a bug?

2013-03-01 Thread Honghe Wu
env: python 2.7.3 6 test files' name in a directory as below: 12ab Abc Eab a1bc acd bc the following is test code: for root, dirs, files in os.walk(os.getcwd()): print files the output in win32 platform is: ['12ab', 'a1bc', 'Abc', 'acd', 'bc', 'Eab'] but in linux is: ['Eab', 'acd', 'a1

Re: is it a bug in exec?

2011-01-21 Thread long
I see now. Thank you so much. I think namespace is really a confusing part in Python. On Friday, January 21, 2011 11:00:32 AM UTC-6, Peter Otten wrote: > There are only two cases that matter: identical local/global namespaces and > distinct local/global namespaces: > > >>> code = """\ > ... x =

Re: is it a bug in exec?

2011-01-21 Thread Peter Otten
longqian9...@gmail.com wrote: > In pyhton 3.1, I found the following code will succeed with argument 1 > to 4 and fail with argument 5 to 9. It is really strange to me. I > suspect it may be a buy in exec() function. Does anyone have some idea > about it? Thanks. > > > t1=""" > class foo: > def

Re: is it a bug in exec?

2011-01-21 Thread long
Of cause your code runs well. But if you remove the "global foo" in main(), it will fail. And it will succeed again if you call exec(t1) directly. I think this behavior is strange. Even I pass a shadow copy of globals and locals to exec, it still fails. So perhaps there is a basic difference betwee

Re: is it a bug in exec?

2011-01-21 Thread Steven D'Aprano
On Thu, 20 Jan 2011 20:52:15 -0800, longqian9...@gmail.com wrote: > In pyhton 3.1, I found the following code will succeed with argument 1 > to 4 and fail with argument 5 to 9. It is really strange to me. I > suspect it may be a buy in exec() function. Does anyone have some idea > about it? Thanks

is it a bug in exec?

2011-01-20 Thread longqian9...@gmail.com
In pyhton 3.1, I found the following code will succeed with argument 1 to 4 and fail with argument 5 to 9. It is really strange to me. I suspect it may be a buy in exec() function. Does anyone have some idea about it? Thanks. t1=""" class foo: def fun(): print('foo') def m

Re: Is it a bug?

2009-09-02 Thread Abhishek Mishra
Oops, missed out that... thanks On Sun, Aug 30, 2009 at 2:25 PM, Jan Kaliszewski wrote: > 30-08-2009 o 06:10:46 Abhishek Mishra wrote: > >> The single quote \' is the culprit. >> When you say  words = ["Hi", "Whats up", "Bye"] and try print words, >> you get this - >> ['Hi', 'Whats up', 'Bye'] >>

Re: Is it a bug?

2009-08-25 Thread Jan Kaliszewski
25-08-2009 o 22:51:14 Gleb Belov wrote: I have two questions: 1) Is it possible and if so, how do I access each individual element? Are there any indexes and what is the syntax? It's a 'Read-The-Friendly-Manual' question. (hint: library reference - Built-in Types - ...) -- Jan Kaliszewski (

Re: Is it a bug?

2009-08-25 Thread Gleb Belov
gt; 1) Is it possible and if so, how do I access each individual element? > > Are there any indexes and what is the syntax? > > For the first element: > > >>> words[0] > > 2) I just noticed that the first and the last words in the output are > > enclosed in single qu

Re: Is it a bug?

2009-08-25 Thread Stephen Fairchild
dexes and what is the syntax? For the first element: >>> words[0] > 2) I just noticed that the first and the last words in the output are > enclosed in single quotes, and the middle one is enclosed in double > quotes. Is it a bug? If not, why does the output work that way? The

Is it a bug?

2009-08-25 Thread Gleb Belov
quot;, "Bye!"] >>> print words ['Hi!', "What's up?", 'Bye!'] I have two questions: 1) Is it possible and if so, how do I access each individual element? Are there any indexes and what is the syntax? 2) I just noticed that the first and the last word

Re: is it a bug in Module copy or i am wrong??

2008-11-07 Thread Terry Reedy
yoma wrote: python version 2.5 in module copy we all know that copy have two method: copy() and deepcopy(). and the explain is - A shallow copy constructs a new compound object and then (to the extent possible) inserts *the same objects* into it that the original contains. - A deep copy con

Re: is it a bug in Module copy or i am wrong??

2008-11-07 Thread Marc 'BlackJack' Rintsch
On Thu, 06 Nov 2008 23:59:51 -0800, yoma wrote: > import copy > > class A: > i = 1 > > class B: > a = A() > > > b = B() > > x=copy.copy(b) > > y=copy.deepcopy(b) > > print id(x.a), id(b.a) > > print id(y.a), id(y.a) > > the result: > 14505264 14505264 > 14505264 14505264 > > So m

Re: is it a bug in Module copy or i am wrong??

2008-11-07 Thread Chris Rebert
On Thu, Nov 6, 2008 at 11:59 PM, yoma <[EMAIL PROTECTED]> wrote: > python version 2.5 in module copy > > we all know that copy have two method: copy() and deepcopy(). > and the explain is > - A shallow copy constructs a new compound object and then (to the > extent possible) inserts *the same obje

is it a bug in Module copy or i am wrong??

2008-11-07 Thread yoma
python version 2.5 in module copy we all know that copy have two method: copy() and deepcopy(). and the explain is - A shallow copy constructs a new compound object and then (to the extent possible) inserts *the same objects* into it that the original contains. - A deep copy constructs a new

Re: is it a bug?

2008-01-27 Thread Gabriel Genellina
En Sun, 27 Jan 2008 14:21:20 -0200, Mr Shore <[EMAIL PROTECTED]> escribi�: > import threading > import time > class timer(threading.Thread): > def __init__(self,no,interval): > threading.Thread.__init__(self) > self.no=no > self.interval=interval > > def run(self)

is it a bug?

2008-01-27 Thread Mr Shore
import threading import time class timer(threading.Thread): def __init__(self,no,interval): threading.Thread.__init__(self) self.no=no self.interval=interval def run(self): while True: print 'Thread Object (%d), Time:%s'%(self.no,time.ctime())

Re: is it a bug ?

2006-10-23 Thread Peter Otten
Sylvain Ferriol wrote: >class Toto(float): >> >>  eq = float.__eq__ >> >> >Toto().eq(42) >> >> False >> > i can not use it because: > class toto(float): > def __init__(self,a=None):pass > > t=toto(a=3) > TypeError: 'a' is an invalid keyword argument for this function Ove

Re: is it a bug ?

2006-10-23 Thread Fredrik Lundh
Sylvain Ferriol wrote: > i just want a class variable named 'eq' so why are you assigning another class' descriptor to it? descriptors are bound to types, and only works properly if used with the type they were created for. > why i can not create some class variables like this ? > > class to

Re: is it a bug ?

2006-10-23 Thread Sylvain Ferriol
Peter Otten a écrit : > Sylvain Ferriol wrote: > > >>can you explain to me what happened: >> >>class toto(object): >> eq = float.__eq__ >> >>t = toto() >> >>getattr(t,'eq') >>TypeError: descriptor '__eq__' for 'float' objects doesn't apply to >>'toto' object > > > float.__eq__ is probably imp

Re: is it a bug ?

2006-10-23 Thread Sylvain Ferriol
Fredrik Lundh a écrit : > Sylvain Ferriol wrote: > >> can you explain to me what happened: >> >> class toto(object): >>eq = float.__eq__ >> >> t = toto() >> >> getattr(t,'eq') >> TypeError: descriptor '__eq__' for 'float' objects doesn't apply to >> 'toto' object > > > I'd say the error mes

Re: is it a bug ?

2006-10-23 Thread Fredrik Lundh
Sylvain Ferriol wrote: > can you explain to me what happened: > > class toto(object): >eq = float.__eq__ > > t = toto() > > getattr(t,'eq') > TypeError: descriptor '__eq__' for 'float' objects doesn't apply to > 'toto' object I'd say the error message explains it pretty well. what did yo

Re: is it a bug ?

2006-10-23 Thread Peter Otten
Sylvain Ferriol wrote: > can you explain to me what happened: > > class toto(object): >eq = float.__eq__ > > t = toto() > > getattr(t,'eq') > TypeError: descriptor '__eq__' for 'float' objects doesn't apply to > 'toto' object float.__eq__ is probably implemented in C and its operation will

is it a bug ?

2006-10-23 Thread Sylvain Ferriol
hello can you explain to me what happened: class toto(object): eq = float.__eq__ t = toto() getattr(t,'eq') TypeError: descriptor '__eq__' for 'float' objects doesn't apply to 'toto' object -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it a bug?

2005-11-09 Thread Diez B. Roggisch
Darren Cui Liang wrote: > Hi, there! > > Now I am working around with the "logging" module. Here is the code: > > > >>> import logging > >>> log1=logging.getLogger("a") > >>> log1.critical("msg") > No handlers could be found for logger "a" > >>> logging.critical("msg") > CRITICAL:root:msg >

Is it a bug?

2005-11-09 Thread Darren Cui Liang
Hi, there! Now I am working around with the "logging" module. Here is the code: >>> import logging >>> log1=logging.getLogger("a") >>> log1.critical("msg") No handlers could be found for logger "a" >>> logging.critical("msg") CRITICAL:root:msg Since every "logger" is under the "root logger"