Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread Xavier Ho
On 29 October 2010 15:50, Paul Rubin no.em...@nospam.invalid wrote: John Nagle na...@animats.com writes: d1 = set('monday','tuesday') days_off = set('saturday','sunday') if not d1.isdisjoint(days_off) :... This is cheaper than intersection, since it doesn't have to allocate

Calling Python from Haskell

2010-10-29 Thread Paul Rubin
For any Haskell fans that might be reading this, here is a blog post (not by me) about a new package for calling Python code from Haskell code. It basically works by connecting the C API's of both languages together: http://john-millikin.com/articles/ride-the-snake/ --

How to Fix JavaScript Error ...

2010-10-29 Thread neha shena
How to Fix JavaScript Error ... Javascript error usually appears with a yellow triangle in pop up box and telling you to debug. A problem with JavaScript embedded in the ..read more http://childschooledu.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

How to Fix JavaScript Error ...

2010-10-29 Thread neha shena
How to Fix JavaScript Error ... Javascript error usually appears with a yellow triangle in pop up box and telling you to debug. A problem with JavaScript embedded in the ..read more http://childschooledu.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread cbr...@cbrownsystems.com
On Oct 28, 11:56 am, Arnaud Delobelle arno...@gmail.com wrote: cbr...@cbrownsystems.com cbr...@cbrownsystems.com writes: It's clear but tedious to write: if 'monday in days_off or tuesday in days_off:     doSomething I currently am tending to write: if any([d for d in ['monday',

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread Carl Banks
On Oct 28, 10:50 pm, Paul Rubin no.em...@nospam.invalid wrote: John Nagle na...@animats.com writes:    d1 = set('monday','tuesday')    days_off = set('saturday','sunday')    if not d1.isdisjoint(days_off) :...    This is cheaper than intersection, since it doesn't have to allocate and

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread HEK
On Oct 28, 6:16 pm, cbr...@cbrownsystems.com cbr...@cbrownsystems.com wrote: It's clear but tedious to write: if 'monday in days_off or tuesday in days_off:     doSomething I currently am tending to write: if any([d for d in ['monday', 'tuesday'] if d in days_off]):     doSomething Is

Re: embarrassing class question

2010-10-29 Thread Gregory Ewing
Brendan wrote: I use Python sporadically, and frequently use the dir command to learn or remind myself of class methods. You can clean up dir() by defining __all__ as a list of names that you want to officially export. Other names will still be there, but they won't show up in the dir()

Re: functions, list, default parameters

2010-10-29 Thread Gregory Ewing
John Nagle wrote: On 10/21/2010 2:51 PM, Chris Rebert wrote: This is a common newbie stumbling-block: Don't use lists (or anything mutable) as default argument values That really should be an error. No, it shouldn't. The criterion isn't whether the object is mutable, but whether you

Re: embarrassing class question

2010-10-29 Thread Paul Rudin
Gregory Ewing greg.ew...@canterbury.ac.nz writes: Brendan wrote: I use Python sporadically, and frequently use the dir command to learn or remind myself of class methods. You can clean up dir() by defining __all__ as a list of names that you want to officially export. Other names will

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread Xavier Ho
Not sure why you use the for-else syntax without a break or continue. And I'm also not sure on the readability. -Xav on his Froyo On 29/10/2010 6:21 PM, HEK elkar...@gmail.com wrote: On Oct 28, 6:16 pm, cbr...@cbrownsystems.com cbr...@cbrownsystems.com wrote: It's clear but tedious to write:

Re: Unix-head needs to Windows-ize his Python script (II)

2010-10-29 Thread Gregory Ewing
Lawrence D'Oliveiro wrote: You mean “GUI console”. So non-GUI apps get a GUI element whether they want it or not, while GUI ones don’t. That’s completely backwards. The G in GUI stands for Graphical. I wouldn't call a window that displays nothing but text graphical. -- Greg --

Re: functions, list, default parameters

2010-10-29 Thread Steven D'Aprano
On Fri, 29 Oct 2010 21:24:23 +1300, Gregory Ewing wrote: John Nagle wrote: On 10/21/2010 2:51 PM, Chris Rebert wrote: This is a common newbie stumbling-block: Don't use lists (or anything mutable) as default argument values That really should be an error. No, it shouldn't. The

Re: Unix-head needs to Windows-ize his Python script (II)

2010-10-29 Thread Gregory Ewing
gb345 wrote: I see how clicking directly on these files would obviate the need to specify the path of the interpreter, but it's still not clear to me how the interpreter would know where to look for the myscript.py module that both the GUI scripts require. If it's in the same directory as the

Re: Python changes

2010-10-29 Thread Steven D'Aprano
On Thu, 28 Oct 2010 14:14:43 -0400, Craig McRoberts wrote: First off, greetings from a newbie! Here's the deal. I gained a passable knowledge of Python nearly ten years ago. Then I decided a career in the computer sciences wasn't for me, and I let it go. Now I find myself back in the

Re: Strong typing vs. strong testing [OT]

2010-10-29 Thread Gregory Ewing
Mark Wooding wrote: Would the world be a better place if we had a name for 2 pi rather than pi itself? I don't think so. The women working in the factory in India that makes most of the worlds 2s would be out of a job. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Python changes

2010-10-29 Thread Steven D'Aprano
On Thu, 28 Oct 2010 20:16:45 +0100, Teenan wrote: On Thu, 2010-10-28 at 15:03 -0400, Craig McRoberts wrote: Thanks for the prompt replies. Sounds like it's time to hit a bookstore. Craig McRoberts You could do a lot worse than getting 'Dive into Python' (There's even a nice new version

Re: Exception Handling in Python 3

2010-10-29 Thread Gregory Ewing
Steve Holden wrote: Yeah, that's a given. Ruby would probably let you do that, but Python insists that you don't dick around with the built-in types. And roghtly so, IMHO. Some restrictions on this are necessary -- it obviously wouldn't be safe to allow replacing the class of an object with

Re: How on Factorial

2010-10-29 Thread Steven D'Aprano
On Thu, 28 Oct 2010 10:13:15 -0400, Dave Angel wrote: Inverting the bits of a floating point number wouldn't make much sense, so fortunately it gives an error. from struct import pack, unpack def float_as_int(x): ... bits = pack(d, x) ... return unpack(q, bits)[0] ... def

Re: Exception Handling in Python 3

2010-10-29 Thread Gregory Ewing
Chris Rebert wrote: Your Traceback is merely being made slightly longer/more complicated than you'd prefer; however, conversely, what if a bug was to be introduced into your exception handler? Then you'd likely very much appreciate the superfluous Traceback info. I think what's disturbing

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread Steven D'Aprano
On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote: It's clear but tedious to write: if 'monday in days_off or tuesday in days_off: doSomething I currently am tending to write: if any([d for d in ['monday', 'tuesday'] if d in days_off]): doSomething Use a

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread Adam Przybyla
cbr...@cbrownsystems.com cbr...@cbrownsystems.com wrote: It's clear but tedious to write: if 'monday in days_off or tuesday in days_off: doSomething I currently am tending to write: if any([d for d in ['monday', 'tuesday'] if d in days_off]): doSomething Is there a better

Re: ANN: PyGUI 2.3

2010-10-29 Thread Gregory Ewing
Daniel Fetchinson wrote: The problem is that some part of the application gets installed to /home/fetchinson/.local/lib/python2.6/site-packages/GUI and some other parts get installed to /home/fetchinson/.local/lib/python/site-packages/GUI Which parts get installed in which places, exactly?

Re: ANN: PyGUI 2.3

2010-10-29 Thread Gregory Ewing
Daniel Fetchinson wrote: Any reason your project is not easy_installable? Mainly because I'm not a setuptools user and haven't been motivated to learn how to do this so far. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception Handling in Python 3

2010-10-29 Thread Chris Rebert
On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Chris Rebert wrote: Your Traceback is merely being made slightly longer/more complicated than you'd prefer; however, conversely, what if a bug was to be introduced into your exception handler? Then you'd likely

Suppressing __context__

2010-10-29 Thread Antoine Pitrou
On Sun, 24 Oct 2010 10:48:23 +0200 Martin v. Loewis mar...@v.loewis.de wrote: You may now wonder whether it is possible to set __context__ to None somehow. See PEP 3134: Open Issue: Suppressing Context As written, this PEP makes it impossible to suppress '__context__', since

Re: Suppressing __context__

2010-10-29 Thread Chris Rebert
On Fri, Oct 29, 2010 at 4:02 AM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 24 Oct 2010 10:48:23 +0200 Martin v. Loewis mar...@v.loewis.de wrote: You may now wonder whether it is possible to set __context__ to None somehow. See PEP 3134: Open Issue: Suppressing Context     As

DateTime object

2010-10-29 Thread jf
Hi, I've a bug in my code and I'm trying de reproduce it. To trace the bug I print arguments, and it produces this: {'date': DateTime '20091020T00:00:00' at 558d128} My question is: what is: DateTime '20091020T00:00:00' at 558d128? I use mx.DateTime put if I print it I get:

Re: DateTime object

2010-10-29 Thread Luca Bel
Take a look here: http://pypi.python.org/pypi/DateTime/ I always use this package only with Zope (it's an application server) If you are simply working in python maybe it's better to use datetime object. Hi. On Fri, Oct 29, 2010 at 1:15 PM, jf j...@aucuneadresse.fr wrote: Hi, I've a bug in

Re: DateTime object

2010-10-29 Thread Adam Tauno Williams
On Fri, 2010-10-29 at 13:15 +0200, jf wrote: Hi, I've a bug in my code and I'm trying de reproduce it. To trace the bug I print arguments, and it produces this: {'date': DateTime '20091020T00:00:00' at 558d128} My question is: what is: DateTime '20091020T00:00:00' at 558d128? I use

Re: Suppressing __context__

2010-10-29 Thread Antoine Pitrou
On Fri, 29 Oct 2010 04:07:15 -0700 Chris Rebert c...@rebertia.com wrote: On Fri, Oct 29, 2010 at 4:02 AM, Antoine Pitrou solip...@pitrou.net wrote: On Sun, 24 Oct 2010 10:48:23 +0200 Martin v. Loewis mar...@v.loewis.de wrote: You may now wonder whether it is possible to set __context__

multiprocessing signal defect

2010-10-29 Thread Neal Becker
Seems multiprocessing doesn't behave well with signals: --- from multiprocessing import Pool import time def sleep (dummy): time.sleep (10) if __name__ == '__main__': pool = Pool (processes=2) result = pool.map (sleep, range (4)) - start it up $ python

Re: multiprocessing signal defect

2010-10-29 Thread Adam Tauno Williams
On Fri, 2010-10-29 at 08:12 -0400, Neal Becker wrote: Seems multiprocessing doesn't behave well with signals: - from multiprocessing import Pool import time def sleep (dummy): time.sleep (10) if __name__ == '__main__': pool = Pool (processes=2) result = pool.map

Re: multiprocessing signal defect

2010-10-29 Thread Neal Becker
Adam Tauno Williams wrote: On Fri, 2010-10-29 at 08:12 -0400, Neal Becker wrote: Seems multiprocessing doesn't behave well with signals: - from multiprocessing import Pool import time def sleep (dummy): time.sleep (10) if __name__ == '__main__': pool = Pool (processes=2)

Re: multiprocessing signal defect

2010-10-29 Thread Adam Tauno Williams
On Fri, 2010-10-29 at 08:39 -0400, Neal Becker wrote: Adam Tauno Williams wrote: On Fri, 2010-10-29 at 08:12 -0400, Neal Becker wrote: Seems multiprocessing doesn't behave well with signals: - from multiprocessing import Pool import time def sleep (dummy): time.sleep

Re: multiprocessing signal defect

2010-10-29 Thread Antoine Pitrou
On Fri, 29 Oct 2010 10:08:01 -0400 Adam Tauno Williams awill...@whitemice.org wrote: No, I don't think so. You're asking the module to over generalize behavior. Reaping of the child is important, and that the child needs to be reaped may matter to the master child (why? did something go

Re: multiprocessing signal defect

2010-10-29 Thread Jean-Paul Calderone
On Oct 29, 10:08 am, Adam Tauno Williams awill...@whitemice.org wrote: signal handler to do something smart in the case of a -15 [for which there isn't really a thread equivalent - can you sent a SystemV style signal to an individual thread in a process?  I don't think so.] Yes.

Re: Suppressing __context__

2010-10-29 Thread Martin v. Loewis
It is not easily discoverable, but it is possible to suppress __context__ by using a bare re-raise afterwards: I see. I'd wrap this like this: def raise_no_context(e): try: raise e except: e.__context__=None raise d = {} try: val = d['nosuch'] except

Re: multiprocessing signal defect

2010-10-29 Thread Adam Tauno Williams
On Fri, 2010-10-29 at 07:31 -0700, Jean-Paul Calderone wrote: On Oct 29, 10:08 am, Adam Tauno Williams awill...@whitemice.org wrote: signal handler to do something smart in the case of a -15 [for which there isn't really a thread equivalent - can you sent a SystemV style signal to an

Re: factorial of negative one (-1)

2010-10-29 Thread Robert Kern
On 10/29/10 12:02 AM, Chris Rebert wrote: On Thu, Oct 28, 2010 at 9:41 PM, Bj Razwhitequill...@gmail.com wrote: I am working with differential equations of the higher roots of negative one. (dividing enormous numbers into other enormous numbers to come out with very reasonable numbers). I am

curses and processing terminal escape characters

2010-10-29 Thread mix
Hi, I'm wondering if there is a way in python to process a string containing terminal escape characters. Example: Please consider the following string: str = ''\x1B[K\x1B[D\x1B[D\x1B[D\x1B[D\x1B[C\x1B[C\x1B[C\x1B[C \x1b[d\x1b[d\x...@q\x1b[@q\x...@q'' as a result of printing it (print str),

Re: Python changes

2010-10-29 Thread rantingrick
On Oct 28, 2:16 pm, Teenan t33...@gmail.com wrote: hmmm bookstore.. those are the things they had before Amazon right? ;) hmm Amazon... Is that the place where you buy tutorials when you could instead get the same info for free with a little Google fu? ;-) --

Re: Exception Handling in Python 3

2010-10-29 Thread rantingrick
On Oct 24, 7:36 am, Steve Holden st...@holdenweb.com wrote: I don't want people to think this is a big deal, however. Nonsense, this IS a big deal. (and Steve grow a spine already!) I was not even aware of this issue until you brought it up -- although i will admit your choice of title is

str(int_var) formatted

2010-10-29 Thread Tracubik
Hi all, i've to convert integer x to string, but if x 10, the string have to be '0x' instead of simple 'x' for example: x = 9 str(x) -- '09' x = 32 str(x) -- '32' x represent hour/minute/second. I can easily add '0' with a if then block, but is there a built-in way to add the '0'

Re: str(int_var) formatted

2010-10-29 Thread Grant Edwards
On 2010-10-29, Tracubik affdfsdfds...@b.com wrote: Hi all, i've to convert integer x to string, but if x 10, the string have to be '0x' instead of simple 'x' for example: x = 9 str(x) -- '09' x = 32 str(x) -- '32' x represent hour/minute/second. I can easily add '0' with a if then

Re: str(int_var) formatted

2010-10-29 Thread none
On 29/10/10 16:59, Tracubik wrote: Hi all, i've to convert integer x to string, but if x 10, the string have to be '0x' instead of simple 'x' for example: x = 9 str(x) -- '09' x = 32 str(x) -- '32' x represent hour/minute/second. I can easily add '0' with a if then block, but is there a

RE: str(int_var) formatted

2010-10-29 Thread Andreas Tawn
Hi all, i've to convert integer x to string, but if x 10, the string have to be '0x' instead of simple 'x' for example: x = 9 str(x) -- '09' x = 32 str(x) -- '32' x represent hour/minute/second. I can easily add '0' with a if then block, but is there a built-in way to add

Re: Pythonic way of saying 'at least one of a, b, or c is in some_list'

2010-10-29 Thread cbr...@cbrownsystems.com
On Oct 29, 2:43 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote: It's clear but tedious to write: if 'monday in days_off or tuesday in days_off:     doSomething I currently am tending to write: if

Re: DateTime object

2010-10-29 Thread jf
Le 29/10/2010 13:41, Adam Tauno Williams a écrit : So what kind of objectDateTime is ? In this case it is clearly mx.DateTime.DateTime. __repr__ and __str__ may produce different representations; Thanks a lot, in fact it is DateTime from xmlrpclib but your post really helped me to find

Re: Exception Handling in Python 3

2010-10-29 Thread MRAB
On 29/10/2010 11:24, Chris Rebert wrote: On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Chris Rebert wrote: Your Traceback is merely being made slightly longer/more complicated than you'd prefer; however, conversely, what if a bug was to be introduced into

Re: str(int_var) formatted

2010-10-29 Thread MRAB
On 29/10/2010 17:18, none @mail.python.org wrote: On 29/10/10 16:59, Tracubik wrote: Hi all, i've to convert integer x to string, but if x 10, the string have to be '0x' instead of simple 'x' for example: x = 9 str(x) -- '09' x = 32 str(x) -- '32' x represent hour/minute/second. I can

Re: curses and processing terminal escape characters

2010-10-29 Thread Tim Harig
On 2010-10-29, mix tmmikolajc...@gmail.com wrote: Hi, I'm wondering if there is a way in python to process a string containing terminal escape characters. Example: Please consider the following string: Python could easily process the escape codes for any given terminal; but, in general, you

Re: Exception Handling in Python 3

2010-10-29 Thread MRAB
On 24/10/2010 13:28, Steve Holden wrote: On 10/24/2010 4:48 AM, Martin v. Loewis wrote: Am 24.10.2010 07:01, schrieb Steve Holden: I was somewhat surprised to discover that Python 3 no longer allows an exception to be raised in an except clause (or rather that it reports it as a separate

Re: Exception Handling in Python 3

2010-10-29 Thread Ethan Furman
MRAB wrote: On 24/10/2010 13:28, Steve Holden wrote: On 10/24/2010 4:48 AM, Martin v. Loewis wrote: Am 24.10.2010 07:01, schrieb Steve Holden: I was somewhat surprised to discover that Python 3 no longer allows an exception to be raised in an except clause (or rather that it reports it as a

Re: curses and processing terminal escape characters

2010-10-29 Thread Dan Stromberg
On Fri, Oct 29, 2010 at 10:35 AM, Tim Harig user...@ilthio.net wrote: On 2010-10-29, mix tmmikolajc...@gmail.com wrote: Hi, I'm wondering if there is a way in python to process a string containing terminal escape characters. Example: Please consider the following string: Python could

Re: Exception Handling in Python 3

2010-10-29 Thread Ethan Furman
MRAB wrote: On 29/10/2010 11:24, Chris Rebert wrote: On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: Chris Rebert wrote: Your Traceback is merely being made slightly longer/more complicated than you'd prefer; however, conversely, what if a bug was to be

Re: Calling a method from invoking module

2010-10-29 Thread Dave Angel
On 2:59 PM, Chris Rebert wrote: On Thu, Oct 28, 2010 at 8:33 PM, Baskaran Sankaranbaskar...@gmail.com wrote: Sorry for the confusion; fooz(), track() and barz() are all members of their respective classes. I must have missed the self argument while creating the synthetic example. Yeah, I

Re: functions, list, default parameters

2010-10-29 Thread Dan Stromberg
On Thu, Oct 21, 2010 at 7:53 PM, John Nagle na...@animats.com wrote: On 10/21/2010 2:51 PM, Chris Rebert wrote: On Thu, Oct 21, 2010 at 2:36 PM, Sean Choigne...@gmail.com wrote: I found two similar questions in the mailing list, but I didn't understand the explanations. I ran this code

Re: Fastest way to detect a non-ASCII character in a list of strings.

2010-10-29 Thread Stefan Behnel
Dun Peal, 28.10.2010 09:10: I find myself surprised at the relatively little use that Cython is seeing. I don't think it's being used that little. It just doesn't show that easily. We get a lot of feedback on the mailing list that suggests that it's actually used by all sorts of people in

Re: Land Of Lisp is out

2010-10-29 Thread Lawrence D'Oliveiro
In message c358a288-cd90-4e84-bfcd-33b21697d...@r14g2000yqa.googlegroups.com, jos...@corporate-world.lisp.de wrote: On 29 Okt., 01:34, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message f2243660-0451-4cda-9e65-9980e2f53...@j25g2000yqa.googlegroups.com, kodifik wrote:

Re: Land Of Lisp is out

2010-10-29 Thread Alessio Stalla
On 28 Ott, 10:42, p...@informatimago.com (Pascal J. Bourguignon) wrote: sthueb...@googlemail.com (Stefan Hübner) writes: Would it be right to say that the only Lisp still in common use is the Elisp built into Emacs? Clojure (http://clojure.org) is a Lisp on the JVM. It's gaining more

Re: is list comprehension necessary?

2010-10-29 Thread Lawrence D'Oliveiro
In message mailman.264.1288112997.2218.python-l...@python.org, Andre Alexander Bell wrote: i = 5 l = [i**2 for i in range(3)] i 2 The last line comes out as 5 in Python 3.1. -- http://mail.python.org/mailman/listinfo/python-list

Are Tkinter StringVar (IntVar, etc) thread safe?

2010-10-29 Thread python
Are Tkinter StringVar (IntVar, FloatVar, etc) thread safe, eg. can a background thread read or write to these objects? Or must I use a Queue to pass information between my background thread and my main Tkinter GUI thread and have my main Tkinter thread pop the Queue and update the application's

Re: Python changes

2010-10-29 Thread Hans-Peter Jansen
On Thursday 28 October 2010, 21:23:03 Craig McRoberts wrote: Oh, I like to browse brick-and-mortar enough. But it's been forever since I've bought something there. If you can get your hands on a copy of Mark Summerfield's Programming in Python3, check it out. He really raised the accustomed

Re: is list comprehension necessary?

2010-10-29 Thread Lawrence D'Oliveiro
In message 4cc701e7$0$1606$742ec...@news.sonic.net, John Nagle wrote: The weird functional if syntax additions were a cave-in to the functional crowd, and may have been a mistake. The only mistake was not putting functional-if into the language in the first place, and having to use that

Re: multiprocessing signal defect

2010-10-29 Thread Antoine Pitrou
On Fri, 29 Oct 2010 08:12:19 -0400 Neal Becker ndbeck...@gmail.com wrote: Seems multiprocessing doesn't behave well with signals: [...] By the way, could you post an issue on the tracker with instructions on how to reproduce (including OS)? Thanks Antoine. --

Re: Python 2.7 or 3.1

2010-10-29 Thread Lawrence D'Oliveiro
In message mailman.289.1288150693.2218.python-l...@python.org, Jorge Biquez wrote: I was wondering if you can comment more about what alternatives to use instead to MySql. My web solutions do not need all the power of a true database, Is more than one process likely to access the data at the

Re: Python 2.7 or 3.1

2010-10-29 Thread Christian Heimes
Am 29.10.2010 23:16, schrieb Lawrence D'Oliveiro: In message mailman.289.1288150693.2218.python-l...@python.org, Jorge Biquez wrote: I was wondering if you can comment more about what alternatives to use instead to MySql. My web solutions do not need all the power of a true database, Is

Re: Python 2.7 or 3.1

2010-10-29 Thread geremy condra
On Wed, Oct 27, 2010 at 7:18 PM, Braden Faulkner brad...@hotmail.com wrote: Would it be safe to say that 2.6 would be even better for beginners than? Let me just come out with a contrary point of view before you go down that path. If you're seriously considering using sqlite, then you may be

Re: Python 2.7 or 3.1

2010-10-29 Thread Jorge Biquez
Hello all Would you consider a not so intelligent move for a newsbie to Python to have maybe version 2.7 and 3.x (if that's possible to be running together on the same machine) to have them run and be learning mainly in 2.7 and see differences in 3.x? In my case I am interested mainly in web

Re: Exception Handling in Python 3

2010-10-29 Thread Greg Ewing
Chris Rebert wrote: On Fri, Oct 29, 2010 at 2:30 AM, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: I think what's disturbing about this is that the two halves of the extended traceback are printed in the wrong order. We're True, but swapping the order would only worsen Steve's problem.

Re: multiprocessing signal defect

2010-10-29 Thread Neal Becker
Antoine Pitrou wrote: On Fri, 29 Oct 2010 08:12:19 -0400 Neal Becker ndbeck...@gmail.com wrote: Seems multiprocessing doesn't behave well with signals: [...] By the way, could you post an issue on the tracker with instructions on how to reproduce (including OS)? Thanks Antoine.

Re: Runtime error

2010-10-29 Thread Peter Pearson
On Thu, 28 Oct 2010 18:26:49 +0200, Sebastian python-maill...@elygor.de wrote: Hi all, I am new to python and I don't know how to fix this error. I only try to execute python (or a cgi script) and I get an ouptu like [...] 'import site' failed; traceback: Traceback (most recent call

RE: Python 2.7 or 3.1

2010-10-29 Thread Braden Faulkner
I personally would take only one bite at a time. Meaning only do one then do the other later. But to each it own :) Date: Fri, 29 Oct 2010 17:48:11 -0500 To: python-list@python.org From: jbiq...@icsmx.com Subject: Re: Python 2.7 or 3.1 Hello all Would you consider a not so

Re: Runtime error

2010-10-29 Thread John Machin
On Oct 29, 3:26 am, Sebastian python-maill...@elygor.de wrote: Hi all, I am new to python and I don't know how to fix this error. I only try to execute python (or a cgi script) and I get an ouptu like [...] 'import site' failed; traceback: Traceback (most recent call last): File

Re: Unix-head needs to Windows-ize his Python script (II)

2010-10-29 Thread Lawrence D'Oliveiro
In message 8ivfa3fif...@mid.individual.net, Gregory Ewing wrote: Lawrence D'Oliveiro wrote: You mean “GUI console”. So non-GUI apps get a GUI element whether they want it or not, while GUI ones don’t. That’s completely backwards. The G in GUI stands for Graphical. I wouldn't call a window

Re: Unix-head needs to Windows-ize his Python script (II)

2010-10-29 Thread Lawrence D'Oliveiro
In message mailman.311.1288232442.2218.python-l...@python.org, Dave Angel wrote: Gee, maybe when you're trying to track down problems, you might try starting the application in a console? On a rationally-designed OS, I have a choice. I can do that, but that’s not really my first resort: the

Re: MATLAB:matplotlib::Mathematica::???

2010-10-29 Thread Lawrence D'Oliveiro
In message i9v3oh$51...@reader1.panix.com, kj wrote: matplotlib, even in its underlying so-called OO mode, follows MATLAB's graphics model, which, in my very subjective opinion, is vastly inferior to Mathematica's. Speaking as someone who once had to do GUI programming in MATLAB, I think

Re: A question I have...

2010-10-29 Thread Lawrence D'Oliveiro
In message mailman.168.1287872943.2218.python-l...@python.org, geremy condra wrote: ... dividing strings by a number doesn't make sense. The logical meaning would be the opposite of multiplying strings by a number: abc * 3 'abcabcabc' abcabcabc // 3 'abc' abcabcabc //

Re: Tools for turning Python code into XMI?

2010-10-29 Thread Lawrence D'Oliveiro
In message 4cc3fad1.5080...@sschwarzer.net, Stefan Schwarzer wrote: I'm looking for a tool which can read Python files and write a corresponding XMI file for import into UML tools. UML ... isn’t that something more in vogue among the Java/DotNet corporate- code-cutter-drone crowd?

Re: ftplib - Did the whole file get sent?

2010-10-29 Thread Lawrence D'Oliveiro
In message 4cc5d9e9$0$1661$742ec...@news.sonic.net, John Nagle wrote: Look at sock_close in socketmodule.c. Note that it ignores the return status on close, always returns None, and never raises an exception. As the Linux manual page for close says: Not checking the return value of

Re: Land Of Lisp is out

2010-10-29 Thread namekuseijin
On 29 out, 19:06, Alessio Stalla alessiosta...@gmail.com wrote: On 28 Ott, 10:42, p...@informatimago.com (Pascal J. Bourguignon) wrote: sthueb...@googlemail.com (Stefan Hübner) writes: Would it be right to say that the only Lisp still in common use is the Elisp built into Emacs?

Re: str(int_var) formatted

2010-10-29 Thread John Yeung
On Oct 29, 11:59 am, Tracubik affdfsdfds...@b.com wrote: i've to convert integer x to string, but if x 10, the string have to be '0x' instead of simple 'x' for example: x = 9 str(x) -- '09' Everyone else seems to prefer the format-based solutions, which is fine. I will give zfill a

Re: downcasting problem

2010-10-29 Thread Lawrence D'Oliveiro
In message ia42sr$e7...@nntp.amis.hr, Nikola Skoric wrote: I have a file full of lines which I parse into Line objects. I also have two subclasses of Line, namely Individual and Family. Constructor of both subclasses needs all Line objects in the file to be constructed, so I cannot construct

Re: Generating PDF file in Python

2010-10-29 Thread Lawrence D'Oliveiro
In message mailman.256.1288099490.2218.python-l...@python.org, Ed Keith wrote: I need to generate PDF files and I'm exploring what tools to use. I was planing on using ReportLab, but recently found some references to pango (http://www.pango.org/) and ciaro (http://cairographics.org/) being

Re: curses and processing terminal escape characters

2010-10-29 Thread Lawrence D'Oliveiro
In message iaf0l9$3h...@speranza.aioe.org, Tim Harig wrote: Python could easily process the escape codes for any given terminal; but, in general, you would want something that works for more then a single terminal type. Does anyone still bother with anything other than VT1xx-type terminals?

Re: embarrassing class question

2010-10-29 Thread Lawrence D'Oliveiro
In message 8idvgaf21...@mid.individual.net, Peter Pearson wrote: Yes, module w imports x, and therefore w.x exists. Is that bad? No-one seems to have come out and said this yet (unless it was in one of those messages that no longer seem to be accessible on my ISP’s news server): Python has

Re: factorial of negative one (-1)

2010-10-29 Thread Bj Raz
Thank you Robert for the clarification. Since I'm an amateur programmer, could you please give me a sample of how I would do it. I'll take some time to study arrays as well, and how to write them, I know of lists, and tuples, and dictionaries; from Dive into Python. but I am very green around

[issue10209] Mac OS X: Decompose filenames on encode, and precompose filenames on decode

2010-10-29 Thread Ronald Oussoren
Ronald Oussoren ronaldousso...@mac.com added the comment: For completeness sake: Apple's Cocoa APIs do not renormalize strings, that is: I've created a file named 'één' in the Terminal, then (using a python 3.2 build): # Terminal input seems NFC: len('één') 3 # Output from os.listdir isn't:

[issue10226] urlparse example is wrong

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: I think this is correct: it is the new behavior after the fix for #754016 was committed. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10226

[issue10198] wave module writes corrupt wav file for zero-length writeframes

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Thanks, fixed in r85914. -- nosy: +georg.brandl resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10198

[issue10224] Build 3.x documentation using python3.x

2010-10-29 Thread Martin v . Löwis
Martin v. Löwis mar...@v.loewis.de added the comment: Did you know break building the 3.x documentation with Python 2? If so, please revert that change. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10224

[issue6715] xz compressor support

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: After applying the patch, it builds fine here and the test suite passes. However, it seems to leak quite a bit -- if I run regrtest with -R::, my system starts swapping heavily after the second run. In lzmamodule, there are lots of API calls

[issue10224] Build 3.x documentation using python3.x

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Nope, these files run just as fine in Python 2. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10224 ___

[issue10224] Build 3.x documentation using python3.x

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: (The usual build process via Makefile still uses Python 2, and that won't change for 3.2.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10224

[issue6715] xz compressor support

2010-10-29 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: @pitrou: Why is this marked Python 3.3? If the error handling in the C module is corrected, it's in a good enough shape to be committed before 3.2b1, and the remaining bugs ironed out until final. I think it needs a real review before going

[issue6715] xz compressor support

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Yes, definitely no externally maintained modules. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6715 ___

[issue10226] urlparse example is wrong

2010-10-29 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Fri, Oct 29, 2010 at 2:15 AM, Georg Brandl rep...@bugs.python.org wrote: .. I think this is correct: it is the new behavior after the fix for #754016 was committed. I agree. I kept the issue open because I cannot

[issue10226] urlparse example is wrong

2010-10-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: That's for Senthil to rephrase as intended :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10226 ___

[issue10225] Fix doctest runable examples in python manual

2010-10-29 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I started with 2.7 branch because some of the issues are the same there, but the tools work better at the moment. I a posting a work-in-progress patch to solicit early feedback. -- versions: +Python 2.7, Python

  1   2   3   >