Re: Fwd: os.statvfs bug or my incompetence ?

2011-10-17 Thread Peter G. Marczis
Hi, not yet, I will check it today, thanks for the idea ! We may have some deeper problem... Br, Peter. On 10/15/2011 05:46 PM, ext Kev Dwyer wrote: Peter G. Marczis wrote: Hello Peter, Welcome to the list. Have you tried calling statvfs from a C program? What happens if you do? Best

Re: How to test if object is an integer?

2011-10-17 Thread Steven D'Aprano
On Mon, 17 Oct 2011 18:59:44 -0600, Ian Kelly wrote: > On Mon, Oct 17, 2011 at 6:40 PM, Chris Kaynor > wrote: >> Python 2.6 running on Windows 7: > 99.0**99**99 >> OverflowError: (34, 'Result too large') Traceback (most recent call >> last): >>   File "", line 1, in >> OverflowError: (34, 'R

Re: How to test if object is an integer?

2011-10-17 Thread Yingjie Lan
- Original Message - > From: Noah Hall > To: MrPink > Cc: python-list@python.org > Sent: Tuesday, October 18, 2011 4:44 AM > Subject: Re: How to test if object is an integer? > There's the isdigit method, for example - > str = "1324325" str.isdigit() > True str = "

Re: How to test if object is an integer?

2011-10-17 Thread Ian Kelly
On Mon, Oct 17, 2011 at 6:40 PM, Chris Kaynor wrote: > Python 2.6 running on Windows 7: 99.0**99**99 > OverflowError: (34, 'Result too large') > Traceback (most recent call last): >   File "", line 1, in > OverflowError: (34, 'Result too large') > > However, from the documentation: > "Becaus

Re: How to test if object is an integer?

2011-10-17 Thread Chris Kaynor
Python 2.6 running on Windows 7: >>> 99.0**99**99 OverflowError: (34, 'Result too large') Traceback (most recent call last):   File "", line 1, in OverflowError: (34, 'Result too large') However, from the documentation: "Because of the lack of standardization of floating point exception handling

Re: How to test if object is an integer?

2011-10-17 Thread Roy Smith
In article , Mathias Lafeldt wrote: > According to [1], there're more Exceptions to test for: > > try: > int(s) > return True > except (TypeError, ValueError, OverflowError): # int conversion failed > return False I don't think I would catch TypeError here. It kind of depends on

Re: How to test if object is an integer?

2011-10-17 Thread Ian Kelly
On Mon, Oct 17, 2011 at 2:44 PM, Noah Hall wrote: > There's the isdigit method, for example - > str = "1324325" str.isdigit() > True str = "1232.34" str.isdigit() > False str = "I am a string, not an int!" str.isdigit() > False That works for non-negative base-10 int

Re: Equal sets with unequal print and str() representations

2011-10-17 Thread Ben Finney
Ganesh Gopalakrishnan writes: > Thanks to all who replied - also to Ben. You're welcome. (Please don't top-post your replies.) > Needless to say I'm new to Python. Welcome to this forum, then! You would be wise to get a solid grounding in Python by working through the Python tutorial from begi

Re: Benefit and belief

2011-10-17 Thread Ben Finney
DevPlayer writes: > Do you not see? For ... > One man's delusion is another man's epiphany. > One man's untruth is another man's belief. > One man's logical undenighable truth is another man's small part of a > bigger picture. Those are just not true. A belief that doesn't match reality is a de

Re: How to test if object is an integer?

2011-10-17 Thread Noah Hall
On Sat, Oct 15, 2011 at 12:44 AM, MrPink wrote: > > Is there a function in Python that can be used to test if the value in > a string is an integer?  I had to make one up for myself and it looks > like this: > > def isInt(s): >    try: >        i = int(s) >        return True >    except ValueErro

Re: Equal sets with unequal print and str() representations

2011-10-17 Thread Ganesh Gopalakrishnan
Thanks to all who replied - also to Ben. I had foolishly assumed that the same set exhibits the same rep on at least one platform. Like any bug, the falsity of my assumption took months to expose - till then, things had worked fine. Needless to say I'm new to Python. (The double printing is be

Re: How to test if object is an integer?

2011-10-17 Thread Mathias Lafeldt
On Sat, Oct 15, 2011 at 1:44 AM, MrPink wrote: > > Is there a function in Python that can be used to test if the value in > a string is an integer?  I had to make one up for myself and it looks > like this: > > def isInt(s): >    try: >        i = int(s) >        return True >    except ValueError

Re: Python hangs: Problem with wxPython, threading, pySerial, or events?

2011-10-17 Thread Ethan Swint
I just wanted to bump this back onto the list since I posted over the weekend. Thanks, Ethan On 10/15/2011 11:17 AM, Ethan Swint wrote: Hi- I'm experiencing crashes in my Win32 Python 2.7 application which appear to be linked to pyzmq. At the moment, I can't even kill the "python.exe *32"

Re: Loop through a dict changing keys

2011-10-17 Thread Gnarlodious
Steven: Thanks for those tips, I've implemented all of them. Also only allowing whitelisted variable names. Feeling much more confident. -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: Benefit and belief

2011-10-17 Thread DevPlayer
On Oct 17, 10:34 am, Steven D'Aprano wrote: > On Mon, 17 Oct 2011 05:59:04 -0700, DevPlayer wrote: > > As has been said for example does 1+1 = 2. Only in one small > > persepective. Whaa? what wack job says stuff like that? 1+1 = 10. In the > > bigger picture there is more then one numberic base b

[OT] Re: Benefit and belief

2011-10-17 Thread Steven D'Aprano
On Mon, 17 Oct 2011 05:59:04 -0700, DevPlayer wrote: > As has been said for example does 1+1 = 2. Only in one small > persepective. Whaa? what wack job says stuff like that? 1+1 = 10. In the > bigger picture there is more then one numberic base besides decimal, > such as binary. That is no more d

Re: callling python function in c

2011-10-17 Thread Ulrich Eckhardt
Am 16.10.2011 10:03, schrieb masood shaik: I am trying to call python function from c code.The following program i got from the web source while i am trying to run this program it throws an segmentation fault. Try checking what functions returns instead of blindly using it. Use a debugger to fi

Re: Language Enhancement Idea to help with multi-processing (your opinions please)

2011-10-17 Thread John Ladasky
On Oct 14, 7:32 pm, alex23 wrote: > You can do this right now with Python 3.2+ and concurrent.futures: > > from concurrent.futures import ThreadPoolExecutor You may have finally sold me on struggling through the upgrade from Python 2.6! I've been doing reasonably well with the Multiprocessing m

Re: Benefit and belief

2011-10-17 Thread DevPlayer
> DevPlayer  wrote: > >I still assert that contradiction is caused by narrow perspective. > >By that I mean: just because an objects scope may not see a certain > >condition, doesn't mean that condition is non-existant. > Groetjes Albert wrote: > This is a far cry from the bible stating that someo

Re: define module in non-standard location?

2011-10-17 Thread Shane
On Oct 16, 11:55 pm, Steven D'Aprano wrote: > On Sun, 16 Oct 2011 19:43:20 -0700, Shane wrote: > > Normally if one has a code set under a directory "top_level" like this: > > > top_level: > >    __main__.py > >    a > >       __init__.py > >       b > >          __init__.py > > > then this directo

Re: type vs. module (part2)

2011-10-17 Thread Steven D'Aprano
On Mon, 17 Oct 2011 06:32:00 +, Steven D'Aprano wrote: > So, bringing this back to your examples... > > Both t and t1 are classes, both know their internal name as "F", but > they are different classes, as seen by the fact that their IDs are > different. Oops, no, sorry, a mistake... assumin

Re: define module in non-standard location?

2011-10-17 Thread Steven D'Aprano
On Sun, 16 Oct 2011 19:43:20 -0700, Shane wrote: > Normally if one has a code set under a directory "top_level" like this: > > top_level: >__main__.py >a > __init__.py > b > __init__.py > > then this directory structure is naturally satisfies this line in > __main__.

Re: type vs. module (part2)

2011-10-17 Thread Steven D'Aprano
On Sun, 16 Oct 2011 16:11:18 -0700, Shane wrote: > In the following t,t1 are the result of built-in call type() -- the form > that takes three arguments. Are you sure about that? Because my explanation below will depend entirely on this alleged fact: that t and t1 themselves are classes, not in

Re: type vs. module (part2)

2011-10-17 Thread alex23
On Oct 17, 9:11 am, Shane wrote: > I now have two questions: How does Python allow two classes of the > same > type as evidenced by identical ``print type()' output and > different id > outputs? You are looking at the id of two _instances_ of the class, not of the class itself. >>> class Example

define module in non-standard location?

2011-10-17 Thread Shane
Normally if one has a code set under a directory "top_level" like this: top_level: __main__.py a __init__.py b __init__.py then this directory structure is naturally satisfies this line in __main__.py: >import a.b But support, for some stupid reason --- say a.b is use

Re: Loop through a dict changing keys

2011-10-17 Thread Steven D'Aprano
On Sun, 16 Oct 2011 17:41:55 -0700, Gnarlodious wrote: > On Oct 16, 5:25 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > >> How do you sanitize user input? > Thanks for your concern. This is what I now have, which merely expands > each value into its usable type (unquotes them): >

Problem with a wx notebook

2011-10-17 Thread faucheuse
Hi there, I've created a wx NoteBook in wich I set multiples panels in wich I set one or more sizers. But nothing displays in the notebook, everything is outside. I've been searching an answer for 2 days ><. Can you help me plz ? Here is my code(with only one panel, to sum up the code) : class St

Re: Loop through a dict changing keys

2011-10-17 Thread Gnarlodious
On Oct 16, 5:25 pm, Steven D'Aprano wrote: > How do you sanitize user input? Thanks for your concern. This is what I now have, which merely expands each value into its usable type (unquotes them): # filter each value try: var=int(var) except ValueError: if var in ('False', 'True'): v

Re: Equal sets with unequal print and str() representations

2011-10-17 Thread Ben Finney
Ganesh Gopalakrishnan writes: > This probably is known, but a potential pitfall (was, for me) nevertheless. > I suspect it is due to hash collisions between 's3' and 's13' in this > case? What is the actual problem? What behaviour is occurring that doesn't match your expectation? > >>> S1==S2 >

Re: Loop through a dict changing keys

2011-10-17 Thread PoD
On Sun, 16 Oct 2011 00:18:40 -0700, Jon Clements wrote: > On Oct 16, 12:53 am, PoD wrote: >> On Sat, 15 Oct 2011 11:00:17 -0700, Gnarlodious wrote: >> > What is the best way (Python 3) to loop through dict keys, examine >> > the string, change them if needed, and save the changes to the same >> >

type vs. module (part2)

2011-10-17 Thread Shane
In the following t,t1 are the result of built-in call type() -- the form that takes three arguments. Therefore they are classes. Consider the following output: print type(t) > print id(t) >1234567 print t.__module__ >a.b.t.d print type(t1) > print id(t1) >1234568 print t1.__module__ >a.b.t.d I n

Re: Loop through a dict changing keys

2011-10-17 Thread Steven D'Aprano
On Sun, 16 Oct 2011 11:20:49 -0700, Gnarlodious wrote: > On Oct 15, 5:53 pm, PoD wrote: > >> data = { >>     'Mobile': 'string', >>     'context': '', >>     'order': '7', >>     'time': 'True'} >> types={'Mobile':str,'context':str,'order':int,'time':bool} >> >> for k,v in data.items(): >>     d

Re: python.org appears to be down

2011-10-17 Thread Miki Tebeka
http://www.isup.me/python.org ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop through a dict changing keys

2011-10-17 Thread Ian Kelly
On Mon, Oct 17, 2011 at 10:21 AM, 8 dihedral wrote: > Uh, sounds reasonable, if one loops over an index variable  that could be > altered during the loop execution then the loop may not end as expected. >From the docs: "Iterating views while adding or deleting entries in the dictionary may

Re: strange comparison result with 'is'

2011-10-17 Thread Terry Reedy
On 10/17/2011 5:19 AM, Peter Otten wrote: The getattr() call is just a distraction. Every x.pop attribute access creates a new method object. In the case of x.pop is x.pop False they have to reside in memory simultaneously while in the expression id(x.pop) == id(x.pop) True a list.pop me

Re: Loop through a dict changing keys

2011-10-17 Thread 88888 dihedral
Uh, sounds reasonable, if one loops over an index variable that could be altered during the loop execution then the loop may not end as expected. -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I get curses to work in Python 3.2 on win-64?

2011-10-17 Thread Brian Curtin
On Sun, Oct 16, 2011 at 11:16, Jan Sundström wrote: > On 16 Okt, 06:59, Christoph Gohlke wrote: >> On Oct 15, 1:13 pm, Jan Sundström wrote: >> >> >> >> `import curses` should work. What exactly is the error message? Does >> `import curses` work outside your program/program directory? >> >> The c

Re: Equal sets with unequal print and str() representations

2011-10-17 Thread Westley Martínez
On Sun, Oct 16, 2011 at 05:52:03PM -0600, Ganesh Gopalakrishnan wrote: > This probably is known, but a potential pitfall (was, for me) > nevertheless. I suspect it is due to hash collisions between 's3' > and 's13' in this case? It happens only rarely, depending on the > contents of the set. > > >

Re: Loop through a dict changing keys

2011-10-17 Thread Chris Angelico
On Mon, Oct 17, 2011 at 5:20 AM, Gnarlodious wrote: > On Oct 15, 5:53 pm, PoD wrote: > >> types={'Mobile':str,'context':str,'order':int,'time':bool} >> >> for k,v in data.items(): >>     data[k] = types[k](v) > > Thanks for the tip, I didn't know you could do that. I ended up > filtering the valu

Re: Loop through a dict changing keys

2011-10-17 Thread Gnarlodious
On Oct 15, 5:53 pm, PoD wrote: > data = { >     'Mobile': 'string', >     'context': '', >     'order': '7', >     'time': 'True'} > types={'Mobile':str,'context':str,'order':int,'time':bool} > > for k,v in data.items(): >     data[k] = types[k](v) Thanks for the tip, I didn't know you could do

Re: How do I get curses to work in Python 3.2 on win-64?

2011-10-17 Thread Jan Sundström
On 16 Okt, 06:59, Christoph Gohlke wrote: > On Oct 15, 1:13 pm, Jan Sundström wrote: > > > > `import curses` should work. What exactly is the error message? Does > `import curses` work outside your program/program directory? > > The curses package is part of the standard library and usually > ins

anagonda sucks )))))))))))))))

2011-10-17 Thread n v
http://123maza.com/48/silver424/ -- http://mail.python.org/mailman/listinfo/python-list

Re: strange comparison result with 'is'

2011-10-17 Thread Terry Reedy
On 10/17/2011 4:42 AM, Yingjie Lan wrote: Hi all, This is quite strange when I used the Python shell with IDLE: Nothing to do with IDLE >>> x = [] >> id(getattr(x, 'pop')) == id(x.pop) True >>> getattr(x, 'pop') is x.pop False I suppose since the two things have the same id, the 'is'-

Re: strange comparison result with 'is'

2011-10-17 Thread Peter Otten
Yingjie Lan wrote: > This is quite strange when I used the Python shell with IDLE: > x = [] id(getattr(x, 'pop')) == id(x.pop) > > True getattr(x, 'pop') is x.pop > False > > I suppose since the two things have the same id, the 'is'-test > should give a True value, but I ge

Message could not be delivered

2011-10-17 Thread Automatic Email Delivery Software
The original message was received at Mon, 17 Oct 2011 12:13:39 +0300 from python.org [153.233.80.188] - The following addresses had permanent fatal errors - - Transcript of session follows - while talking to python.org.: >>> MAIL From:"Automatic Email Delivery Software" <<< 50

strange comparison result with 'is'

2011-10-17 Thread Yingjie Lan
Hi all,  This is quite strange when I used the Python shell with IDLE: >>> x = [] >>> id(getattr(x, 'pop')) == id(x.pop) True >>> getattr(x, 'pop') is x.pop False >>>  I suppose since the two things have the same id, the 'is'-test  should give a True value, but I get a False value.  Any partic