Re: How to test if object is an integer?

2011-10-14 Thread 惜悯
retrun True if type(i) is int else False -- Original -- From: Chris Angelicoros...@gmail.com; Date: Sat, Oct 15, 2011 08:55 AM To: python-listpython-list@python.org; Subject: Re: How to test if object is an integer? On Sat, Oct 15, 2011 at 10:44 AM

Re: How to test if object is an integer?

2011-10-14 Thread Chris Angelico
2011/10/15 惜悯 wa...@qq.com: retrun True if type(i) is int else False That tests if the object is already an int; the OP asked if a string contains an integer. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if object is an integer?

2011-10-14 Thread Chris Rebert
On Fri, Oct 14, 2011 at 6:05 PM, Chris Angelico ros...@gmail.com wrote: 2011/10/15 惜悯 wa...@qq.com: retrun True if type(i) is int else False That tests if the object is already an int; the OP asked if a string contains an integer. Additionally: * the if-then-else there is unnecessary since

Re: How to test if object is an integer?

2011-10-14 Thread Terry Reedy
On 10/14/2011 9:05 PM, Chris Angelico wrote: 2011/10/15 惜悯wa...@qq.com: retrun True if type(i) is int else False That tests if the object is already an int; the OP asked if a string contains an integer. The misleading subject line did not. It should have been How to test if a string

Re: How to test if object is an integer?

2011-10-14 Thread Ben Finney
Terry Reedy tjre...@udel.edu writes: On 10/14/2011 9:05 PM, Chris Angelico wrote: That tests if the object is already an int; the OP asked if a string contains an integer. The misleading subject line did not. It should have been How to test if a string contains an integer? Which would

Re: How to test if a module exists?

2010-11-12 Thread Tim Chase
: gmane.comp.python.general Subject: Re: How to test if a module exists? Date: Fri, 12 Nov 2010 09:26:51 +1300 Organization: Geek Central Lines: 13 Approved: n...@gmane.org Message-ID: ibhjib$q0...@lust.ihug.co.nz References: aanlktikr5euhqpupa3yrid98oas92zfhk8u9lha5y...@mail.gmail.com mailman

Re: How to test if a module exists?

2010-11-12 Thread Steven D'Aprano
On Thu, 11 Nov 2010 16:51:38 -0800, Ethan Furman wrote: Lawrence D'Oliveiro wrote: As for those who persisted in posting my address after being warned of this, I’m still deciding what to do. You can be such an ass sometimes. Sometimes? -- Steven --

Re: How to test if a module exists?

2010-11-12 Thread Steve Holden
On 11/12/2010 3:51 PM, Steven D'Aprano wrote: On Thu, 11 Nov 2010 16:51:38 -0800, Ethan Furman wrote: Lawrence D'Oliveiro wrote: As for those who persisted in posting my address after being warned of this, I’m still deciding what to do. You can be such an ass sometimes. Sometimes?

Re: How to test if a module exists?

2010-11-11 Thread Mark Wooding
r0g aioe@technicalbloke.com writes: Really? I get a metric butt-ton of spam every day to this address. I'm sure I get sent a lot of spam (though I don't know for sure -- see below). But I don't think much of it comes from Usenet harvesters any more. Right now it simply filtered by

Re: How to test if a module exists?

2010-11-11 Thread r0g
On 11/11/10 11:28, Mark Wooding wrote: r0gaioe@technicalbloke.com writes: Really? I get a metric butt-ton of spam every day to this address. I'm sure I get sent a lot of spam (though I don't know for sure -- see below). But I don't think much of it comes from Usenet harvesters any

Re: How to test if a module exists?

2010-11-11 Thread Lawrence D'Oliveiro
In message mailman.853.1289449099.2218.python-l...@python.org, Jon Dufresne wrote: On Wed, Nov 10, 2010 at 1:50 AM, Lawrence D'Oliveiro wrote: In message mailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see

Re: How to test if a module exists?

2010-11-11 Thread Lawrence D'Oliveiro
In message mailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html would seem to be an independent, true record of what

Re: How to test if a module exists?

2010-11-11 Thread Tim Chase
/1260153.html. How about we look at an excerpt of the message you just sent: === From: Lawrence D'Oliveiro l...@geek-central.gen.nz Newsgroups: gmane.comp.python.general Subject: Re: How to test if a module exists? Date: Fri, 12 Nov 2010 08:49:18 +1300 [snip] On Mon, Nov

Re: How to test if a module exists?

2010-11-11 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message mailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html would seem to be an

Re: How to test if a module exists?

2010-11-11 Thread Steve Holden
On 11/11/2010 3:26 PM, Lawrence D'Oliveiro wrote: In message mailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html

Re: How to test if a module exists?

2010-11-11 Thread r0g
On 11/11/10 20:26, Lawrence D'Oliveiro wrote: In messagemailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html would

Re: How to test if a module exists?

2010-11-11 Thread Ian
On Nov 11, 1:26 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: In message mailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This

Re: How to test if a module exists?

2010-11-11 Thread Emile van Sebille
I'm using thunderbird via gmane and see the sender shown as l...@geek-central.gen.nz -- so, no lies -- you've been self-outed. Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-11 Thread MRAB
On 11/11/2010 20:26, Lawrence D'Oliveiro wrote: In messagemailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html would

Re: How to test if a module exists?

2010-11-11 Thread Ethan Furman
Lawrence D'Oliveiro l...@geek-central.gen.nz wrote: In message mailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html

Re: How to test if a module exists?

2010-11-11 Thread Lawrence D'Oliveiro
In message mailman.894.1289510633.2218.python-l...@python.org, MRAB wrote: ... the next one at 3 Nov 2010 22:40 Re: Allowing comments after the line continuation backslash and _all_ the subsequent ones arrived with an _unobfuscated_ email address. You mean from this one on

Re: How to test if a module exists?

2010-11-11 Thread Dave Angel
On 2:59 PM, Lawrence D'Oliveiro wrote: In messagemailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html would seem to be

Re: How to test if a module exists?

2010-11-11 Thread Ethan Furman
Dave Angel wrote: On 2:59 PM, Lawrence D'Oliveiro wrote: In messagemailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This

Re: How to test if a module exists?

2010-11-11 Thread MRAB
On 11/11/2010 21:53, Lawrence D'Oliveiro wrote: In messagemailman.894.1289510633.2218.python-l...@python.org, MRAB wrote: ... the next one at 3 Nov 2010 22:40 Re: Allowing comments after the line continuation backslash and _all_ the subsequent ones arrived with an _unobfuscated_ email address.

Re: How to test if a module exists?

2010-11-11 Thread Emile van Sebille
On 11/11/2010 2:01 PM Dave Angel said... I subscribe to this list by email, in digest form. And your email address here has a real @ in it. Don't be so free to call people liars when they're reporting what they actually see. If you get this message directly, you can look at the TO: list. I just

Re: How to test if a module exists?

2010-11-11 Thread Steve Holden
On 11/11/2010 1:53 PM, Lawrence D'Oliveiro wrote: In message mailman.894.1289510633.2218.python-l...@python.org, MRAB wrote: ... the next one at 3 Nov 2010 22:40 Re: Allowing comments after the line continuation backslash and _all_ the subsequent ones arrived with an _unobfuscated_ email

Re: How to test if a module exists?

2010-11-11 Thread Mark Wooding
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: In message mailman.894.1289510633.2218.python-l...@python.org, MRAB wrote: ... the next one at 3 Nov 2010 22:40 Re: Allowing comments after the line continuation backslash and _all_ the subsequent ones arrived with an

Re: How to test if a module exists?

2010-11-11 Thread Robert Kern
On 2010-11-11 14:26 , Lawrence D'Oliveiro wrote: In messagemailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This http://mail.python.org/pipermail/python-list/2010-November/1260153.html would

Re: How to test if a module exists?

2010-11-11 Thread Seebs
On 2010-11-11, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message mailman.843.1289438674.2218.python-l...@python.org, Tim Chase wrote: Amusingly, as others have noted, you replied with an unobfuscated email address. This

Re: How to test if a module exists?

2010-11-11 Thread Seebs
On 2010-11-11, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message mailman.894.1289510633.2218.python-l...@python.org, MRAB wrote: ... the next one at 3 Nov 2010 22:40 Re: Allowing comments after the line continuation backslash and _all_ the subsequent ones arrived with an

Re: How to test if a module exists?

2010-11-11 Thread Seebs
On 2010-11-11, Tim Chase python.l...@tim.thechases.com wrote: === From: Lawrence D'Oliveiro unobfuscated Newsgroups: gmane.comp.python.general Oh, interesting. Gee...your unobfuscated email addresses FROM YOU. No, from gmane. Out here in comp.lang.python (no

Re: How to test if a module exists?

2010-11-11 Thread r0g
On 11/11/10 21:53, Lawrence D'Oliveiro wrote: In messagemailman.894.1289510633.2218.python-l...@python.org, MRAB wrote: ... the next one at 3 Nov 2010 22:40 Re: Allowing comments after the line continuation backslash and _all_ the subsequent ones arrived with an _unobfuscated_ email address.

Re: How to test if a module exists?

2010-11-11 Thread Lawrence D'Oliveiro
I have just received an admission from Barry Warsaw that a hack was done on python-list specifically to deal with bounces caused by a list member trying to reply to my obfuscated e-mail address. I have asked him to undo that hack. If he likes, he can filter out that (obfuscated) address of

Re: How to test if a module exists?

2010-11-11 Thread Ethan Furman
Lawrence D'Oliveiro wrote: The important point, as far as I’m concerned, is that I do NOT want to see my unobfuscated address appear on USENET. You sure did a lousy job of obfuscating for someone so concerned about it. As for those who persisted in posting my address after being warned of

Re: How to test if a module exists?

2010-11-11 Thread Grant Edwards
On 2010-11-12, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: As for those who persisted in posting my address after being warned of this, I'm still deciding what to do. Plonk. -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-11 Thread Steve Holden
On 11/11/2010 4:55 PM, Grant Edwards wrote: On 2010-11-12, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: As for those who persisted in posting my address after being warned of this, I'm still deciding what to do. Plonk. Don't you mean On 2010-11-12, Lawrence D'Oliveiro

Re: How to test if a module exists?

2010-11-11 Thread Tim Chase
On 11/11/10 18:20, Lawrence D'Oliveiro wrote: As for those who persisted in posting my address after being warned of this, I’m still deciding what to do. I've got a hint: 1) You can pursue it with various ISPs. If you choose the latter, I can fairly confidently say that any provider, upon

Re: How to test if a module exists?

2010-11-11 Thread Emile van Sebille
On 11/11/2010 4:20 PM Lawrence D'Oliveiro said... I have just received an admission from Barry Warsaw that a hack was done on python-list specifically to deal with bounces caused by a list member trying to reply to my obfuscated e-mail address. I have asked him to undo that hack. If he likes,

Re: How to test if a module exists?

2010-11-11 Thread Seebs
On 2010-11-12, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: I have just received an admission from Barry Warsaw that a hack was done on python-list specifically to deal with bounces caused by a list member trying to reply to my obfuscated e-mail address. That's...

Re: How to test if a module exists?

2010-11-11 Thread Lawrence D'Oliveiro
I have asked for my messages to be filtered from being distributed to python-list. As far as I’m concerned, the lot of you can bloody piss off. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-11 Thread alex23
On Nov 12, 2:53 pm, Lawrence D'Oliveiro l...@geek- central.gen.new_zealand wrote: I have asked for my messages to be filtered from being distributed to python-list. As far as I’m concerned, the lot of you can bloody piss off. Oh Lawrence, the feeling is mutual. At least then we'd be spared your

Re: How to test if a module exists?

2010-11-10 Thread Mark Wooding
r0g aioe@technicalbloke.com writes: You use your main address on USENET rather than a junk one!? Obfuscated or not that's either brave or foolhardy! I use my real email address. I also have an aggressive spam filter. But I don't think that much of my comes from Usenet harvesters any more,

Re: How to test if a module exists?

2010-11-10 Thread r0g
On 10/11/10 09:50, Lawrence D'Oliveiro wrote: In messagemailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a

Re: How to test if a module exists?

2010-11-10 Thread Lawrence D'Oliveiro
In message mailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming

Re: How to test if a module exists?

2010-11-10 Thread Martin Gregorie
On Wed, 10 Nov 2010 12:04:01 +, Mark Wooding wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this was a momentary

Re: How to test if a module exists?

2010-11-10 Thread Mark Wooding
Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this was a momentary lapse of judgement, for which I expect an apology.

Re: How to test if a module exists?

2010-11-10 Thread Robert Kern
On 11/10/10 3:50 AM, Lawrence D'Oliveiro wrote: In messagemailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a

Re: How to test if a module exists?

2010-11-10 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message mailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the

Re: How to test if a module exists?

2010-11-10 Thread Robert Kern
On 11/10/10 2:27 PM, Robert Kern wrote: On 11/10/10 3:50 AM, Lawrence D'Oliveiro wrote: In messagemailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on

Re: How to test if a module exists?

2010-11-10 Thread Steve Holden
On 11/10/2010 4:50 AM, Lawrence D'Oliveiro wrote: In message mailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it

Re: How to test if a module exists?

2010-11-10 Thread Tim Chase
On 11/10/10 03:50, Lawrence D'Oliveiro wrote: In messagemailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: Lawrence D'Oliveiro l...@geek-central.gen.nz wrote: I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason,

Re: How to test if a module exists?

2010-11-10 Thread Jon Dufresne
On Wed, Nov 10, 2010 at 1:50 AM, Lawrence D'Oliveiro l...@geek-central.gen.nz wrote: In message mailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET

Re: How to test if a module exists?

2010-11-10 Thread Robert Kern
On 2010-11-10 22:18 , Jon Dufresne wrote: On Wed, Nov 10, 2010 at 1:50 AM, Lawrence D'Oliveiro l...@geek-central.gen.fine.whatever wrote: In messagemailman.780.1289326087.2218.python-l...@python.org, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that

Re: How to test if a module exists?

2010-11-10 Thread r0g
On 10/11/10 12:45, Mark Wooding wrote: r0gaioe@technicalbloke.com writes: You use your main address on USENET rather than a junk one!? Obfuscated or not that's either brave or foolhardy! I use my real email address. I also have an aggressive spam filter. But I don't think that much of

Re: How to test if a module exists?

2010-11-09 Thread Lawrence D'Oliveiro
In message roy-e7c8b9.22342706112...@news.panix.com, Roy Smith wrote: Fail early and often, that's what I say. Good advice that could apply to lots of things. Except maybe procrastination ... :) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-09 Thread Jean-Michel Pichavant
Jon Dufresne wrote: On Sat, Nov 6, 2010 at 1:52 PM, Roy Smith r...@panix.com wrote: import sys try: import xx except ImportError: tb = sys.exc_traceback while tb: print tb tb = tb.tb_next I went ahead and implemented this and it now works. I even uncovered a

Re: How to test if a module exists?

2010-11-09 Thread Roy Smith
In article ibatkk$t7...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message roy-4c92bb.16523506112...@news.panix.com, Roy Smith wrote: On the other hand, if your module's bug is that it in turn imports some other module, which doesn't exist, you'll

Re: How to test if a module exists?

2010-11-09 Thread Jon Dufresne
On Tue, Nov 9, 2010 at 4:30 AM, Roy Smith r...@panix.com wrote: In article ibatkk$t7...@lust.ihug.co.nz,  Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message roy-4c92bb.16523506112...@news.panix.com, Roy Smith wrote: On the other hand, if your module's bug is that it in

Re: How to test if a module exists?

2010-11-09 Thread Jon Dufresne
On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro l...@geek-central.gen.nz wrote: In message roy-4c92bb.16523506112...@news.panix.com, Roy Smith wrote: On the other hand, if your module's bug is that it in turn imports some other module, which doesn't exist, you'll also get an ImportError.

Re: How to test if a module exists?

2010-11-08 Thread Lawrence D'Oliveiro
In message roy-4c92bb.16523506112...@news.panix.com, Roy Smith wrote: On the other hand, if your module's bug is that it in turn imports some other module, which doesn't exist, you'll also get an ImportError. Does it really matter? Either way, the module is unusable. --

Re: How to test if a module exists?

2010-11-06 Thread Chris Rebert
On Sat, Nov 6, 2010 at 11:22 AM, Jon Dufresne jon.dufre...@gmail.com wrote: Hi, My python program has an extension system where the extension can have a optional magic python modules. Meaning if the extension module exists, the program will use it and if not, it will continue without the

Re: How to test if a module exists?

2010-11-06 Thread Jon Dufresne
On Sat, Nov 6, 2010 at 11:35 AM, Chris Rebert c...@rebertia.com wrote: Here's what I came up with: try:     import extension_magic_module except ImportError as err:    if err.message != No module named extension_magic_module:        raise err else:    handle_extension_magic_module() It

Re: How to test if a module exists?

2010-11-06 Thread Rob Williscroft
Jon Dufresne wrote in news:aanlktikr5euhqpupa3yrid98oas92zfhk8u9lha5y...@mail.gmail.com in gmane.comp.python.general: try: import extension_magic_module except ImportError: pass else: handle_extension_magic_module() However, if the the extension module exists but throws

Re: How to test if a module exists?

2010-11-06 Thread Mark Wooding
Chris Rebert c...@rebertia.com writes: if err.message != No module named extension_magic_module: Ugh! Surely this can break if you use Python with different locale settings! -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-06 Thread Chris Rebert
On Sat, Nov 6, 2010 at 1:01 PM, Mark Wooding m...@distorted.org.uk wrote: Chris Rebert c...@rebertia.com writes:     if err.message != No module named extension_magic_module: Ugh!  Surely this can break if you use Python with different locale settings! Since when does Python have translated

Re: How to test if a module exists?

2010-11-06 Thread Roy Smith
In article mailman.699.1289068535.2218.python-l...@python.org, Chris Rebert c...@rebertia.com wrote: On Sat, Nov 6, 2010 at 11:22 AM, Jon Dufresne jon.dufre...@gmail.com wrote: [...] However, if the the extension module exists but throws an ImportError, due to a bug in the extension this

Re: How to test if a module exists?

2010-11-06 Thread Chris Rebert
On Sat, Nov 6, 2010 at 11:50 AM, Jon Dufresne jon.dufre...@gmail.com wrote: On Sat, Nov 6, 2010 at 11:35 AM, Chris Rebert c...@rebertia.com wrote: Here's what I came up with: try:     import extension_magic_module except ImportError as err:    if err.message != No module named

Re: How to test if a module exists?

2010-11-06 Thread Steven D'Aprano
On Sat, 06 Nov 2010 13:54:09 -0700, Chris Rebert wrote: On Sat, Nov 6, 2010 at 1:01 PM, Mark Wooding m...@distorted.org.uk wrote: Chris Rebert c...@rebertia.com writes:     if err.message != No module named extension_magic_module: Ugh!  Surely this can break if you use Python with

Re: How to test if a module exists?

2010-11-06 Thread Mark Wooding
Chris Rebert c...@rebertia.com writes: Since when does Python have translated error messages? It doesn't yet. How much are you willing to bet that it never will? ;-) -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to test if a module exists?

2010-11-06 Thread Roy Smith
In article 4cd5d8a3$0$30004$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: Since when does Python have translated error messages? Since Python 3.2.4. Or will it be 3.3.5? I will forget. *wink* from __future__ import bugs :-) --

Re: How to test if a module exists?

2010-11-06 Thread Seebs
On 2010-11-06, Roy Smith r...@panix.com wrote: from __future__ import bugs Now I want this. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nos...@seebs.net http://www.seebs.net/log/ -- lawsuits, religion, and funny pictures

Re: How to test if a module exists?

2010-11-06 Thread Jon Dufresne
On Sat, Nov 6, 2010 at 1:52 PM, Roy Smith r...@panix.com wrote: import sys try:    import xx except ImportError:    tb = sys.exc_traceback    while tb:        print tb        tb = tb.tb_next I went ahead and implemented this and it now works. I even uncovered a bug I wasn't previously

Re: How to test if a module exists?

2010-11-06 Thread Roy Smith
In article mailman.710.1289095058.2218.python-l...@python.org, Jon Dufresne jon.dufre...@gmail.com wrote: I went ahead and implemented this and it now works. I even uncovered a bug I wasn't previously seeing because now the program was failing early! :) Excellent. Fail early and often,

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 12:13 PM, kj no.em...@please.post wrote: snip It would facilitate the implementation of t() to have a simple test for mutability.  Is there one? Non-default hashability is an approximate heuristic: def is_immutable(x): try: hash(x) except TypeError:

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Arnaud Delobelle
kj no.em...@please.post writes: I want to implement a test t() that will return True if its two arguments are completely different. By this I mean that they don't share any non-atomic component. E.g., if a = [0, 1] b = [0, 1] c = [2, 3] d = [2, 3] A = (a, c, 0) B = (a, d, 1) C = (b,

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 1:46 PM, Arnaud Delobelle arno...@gmail.com wrote: kj no.em...@please.post writes: I want to implement a test t() that will return True if its two arguments are completely different.  By this I mean that they don't share any non-atomic component.  E.g., if a = [0, 1]

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Arnaud Delobelle
Chris Rebert c...@rebertia.com writes: On Thu, Oct 7, 2010 at 1:46 PM, Arnaud Delobelle arno...@gmail.com wrote: [...] I think defining mutability is subject to opinion, but here is a first approximation. def mutable(obj):    return obj.__hash__ is None or type(obj).__hash__ ==

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Christian Heimes
Am 07.10.2010 22:02, schrieb Chris Rebert: On Thu, Oct 7, 2010 at 12:13 PM, kj no.em...@please.post wrote: snip It would facilitate the implementation of t() to have a simple test for mutability. Is there one? Non-default hashability is an approximate heuristic: Except that every user

Re: how to test for atomicity/mutability/hashability?

2010-10-07 Thread Chris Rebert
On Thu, Oct 7, 2010 at 2:28 PM, Christian Heimes li...@cheimes.de wrote: Am 07.10.2010 22:02, schrieb Chris Rebert: On Thu, Oct 7, 2010 at 12:13 PM, kj no.em...@please.post wrote: snip It would facilitate the implementation of t() to have a simple test for mutability.  Is there one?

Re: How to test/troubshoot an extension (pylibconfig)?

2010-07-08 Thread Grant Edwards
On 2010-07-07, Grant Edwards inva...@invalid.invalid wrote: Oops. Those Python bindings are for version 1.3.2 of libconfig (which does work). They don't work with the current version of libconfig. I've stripped the python bindings down to a minimal point, and I've decided there may be a

Re: How to test/troubshoot an extension (pylibconfig)?

2010-07-08 Thread Grant Edwards
On 2010-07-08, Grant Edwards inva...@invalid.invalid wrote: On 2010-07-07, Grant Edwards inva...@invalid.invalid wrote: Oops. Those Python bindings are for version 1.3.2 of libconfig (which does work). They don't work with the current version of libconfig. Python 2.6.5 (release26-maint,

Re: How to test/troubshoot an extension (pylibconfig)?

2010-07-07 Thread Grant Edwards
On 2010-07-07, Grant Edwards inva...@invalid.invalid wrote: I'm trying to use python bindings for libconfig. There appear to be three very slightly different bindings: http://code.google.com/p/python-libconfig/ http://wiki.github.com/cnangel/python-libconfig/

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

2010-05-12 Thread MRAB
robert somerville wrote: I am trying to determine how to test whether variors bits are set within a byte (or larger flag) , the python 'and' and 'or' do not seem to be doing what i want .. does anybody have some sample code showing how to do it ?? e.g. (in C) unsigned char a = 6; is 3rd

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

2010-05-12 Thread cjw
On 12-May-10 14:40 PM, MRAB wrote: robert somerville wrote: I am trying to determine how to test whether variors bits are set within a byte (or larger flag) , the python 'and' and 'or' do not seem to be doing what i want .. does anybody have some sample code showing how to do it ?? e.g. (in C)

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

2010-05-12 Thread Mensanator
On May 12, 1:40 pm, MRAB pyt...@mrabarnett.plus.com wrote: robert somerville wrote: I am trying to determine how to test whether variors bits are set within a byte (or larger flag) , the python 'and' and 'or' do not seem to be doing what i want .. does anybody have some sample code showing

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:

Re: How to test a URL request in a while True loop

2010-01-13 Thread Aahz
In article mailman.233.1262197919.28905.python-l...@python.org, Philip Semanchuk phi...@semanchuk.com wrote: While I don't fully understand what you're trying to accomplish by changing the URL to google.com after 3 iterations, I suspect that some of your trouble comes from using while True.

Re: How to test a URL request in a while True loop

2010-01-13 Thread Aahz
In article hilruv$nu...@panix5.panix.com, Aahz a...@pythoncraft.com wrote: In article mailman.233.1262197919.28905.python-l...@python.org, Philip Semanchuk phi...@semanchuk.com wrote: While I don't fully understand what you're trying to accomplish by changing the URL to google.com after 3

Re: How to test a URL request in a while True loop

2009-12-30 Thread samwyse
On Dec 30, 10:00 am, Brian D brianden...@gmail.com wrote: What I don't understand is how to test for a valid URL request, and then jump out of the while True loop to proceed to another line of code below the loop. There's probably faulty logic in this approach. I imagine I should wrap the URL

Re: How to test a URL request in a while True loop

2009-12-30 Thread Brian D
On Dec 30, 11:06 am, samwyse samw...@gmail.com wrote: On Dec 30, 10:00 am, Brian D brianden...@gmail.com wrote: What I don't understand is how to test for a valid URL request, and then jump out of the while True loop to proceed to another line of code below the loop. There's probably

Re: How to test a URL request in a while True loop

2009-12-30 Thread Philip Semanchuk
On Dec 30, 2009, at 11:00 AM, Brian D wrote: I'm actually using mechanize, but that's too complicated for testing purposes. Instead, I've simulated in a urllib2 sample below an attempt to test for a valid URL request. I'm attempting to craft a loop that will trap failed attempts to request a

Re: How to test a URL request in a while True loop

2009-12-30 Thread MRAB
Brian D wrote: On Dec 30, 11:06 am, samwyse samw...@gmail.com wrote: On Dec 30, 10:00 am, Brian D brianden...@gmail.com wrote: What I don't understand is how to test for a valid URL request, and then jump out of the while True loop to proceed to another line of code below the loop. There's

Re: How to test a URL request in a while True loop

2009-12-30 Thread Brian D
On Dec 30, 12:31 pm, Philip Semanchuk phi...@semanchuk.com wrote: On Dec 30, 2009, at 11:00 AM, Brian D wrote: I'm actually using mechanize, but that's too complicated for testing purposes. Instead, I've simulated in a urllib2 sample below an attempt to test for a valid URL request.

Re: How to test a URL request in a while True loop

2009-12-30 Thread Brian D
Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to the

Re: How to test a URL request in a while True loop

2009-12-30 Thread MRAB
Brian D wrote: Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the solution I got to work. The main body of the code passes a URL to

Re: How to test a URL request in a while True loop

2009-12-30 Thread Brian D
On Dec 30, 7:08 pm, MRAB pyt...@mrabarnett.plus.com wrote: Brian D wrote: Thanks MRAB as well. I've printed all of the replies to retain with my pile of essential documentation. To follow up with a complete response, I'm ripping out of my mechanize module the essential components of the

Re: How to test a URL request in a while True loop

2009-12-30 Thread Steve Holden
Brian D wrote: [...] I'm definitely acquiring some well-deserved schooling -- and it's really appreciated. I'd seen the is/is not preference before, but it just didn't stick. Yes, a lot of people have acquired the majority of their Python education from this list - I have certainly learned a

Re: How to test urllib|urllib2-using code?

2009-11-04 Thread Lutz Horn
Hi, kj wrote: I want to write some tests for code that uses both urllib and urllib2. Take a look at the discussion under the title How can one mock/stub python module like urllib at stackoverflow: http://stackoverflow.com/questions/295438/how-can-one-mock-stub-python-module-like-urllib Lutz

Re: How to test urllib|urllib2-using code?

2009-11-04 Thread Steven D'Aprano
On Wed, 04 Nov 2009 15:06:45 +0100, Lutz Horn wrote: Hi, kj wrote: I want to write some tests for code that uses both urllib and urllib2. Take a look at the discussion under the title How can one mock/stub python module like urllib at stackoverflow:

Re: How to test if a file is a symbolic link?

2009-10-28 Thread D'Arcy J.M. Cain
On Wed, 28 Oct 2009 22:19:55 -0500 Peng Yu pengyu...@gmail.com wrote: 'symbolic_link' is a symbolic link in the current directory. I run 'python main.py', but it does not return me anything. I want to check if a file is a symbolic link. I'm wondering what is the correct way to do so? $cat

<    1   2   3   >