Tryton 2.6 released

2012-10-26 Thread Cédric Krier
Hi, We are happy to announce the 2.6 release of Tryton. What is Tryton == Tryton is a three-tiers high level general purpose application platform using either PostgreSQL, MySQL or SQLite as database engine. The core of Tryton (also called Tryton kernel) provides all the necessary

Re: a.index(float('nan')) fails

2012-10-26 Thread Cameron Simpson
On 25Oct2012 22:04, Terry Reedy tjre...@udel.edu wrote: | Containment of nan in collection is tested by is, not ==. | nan = float('nan') | nan2 = float('nan') | nan2 is nan | False This argues otherwise, and for use of math.isnan() instead. I expect you were making the point that another

Re: while expression feature proposal

2012-10-26 Thread Paul Rubin
Dan Loewenherz dloewenh...@gmail.com writes: In this case, profile_id is None when the loop breaks. It would be much more straightforward (and more Pythonic, IMO), to write: client = StrictRedis() while client.spop(profile_ids) as profile_id: print profile_id That is pretty

Re: while expression feature proposal

2012-10-26 Thread Chris Angelico
On Fri, Oct 26, 2012 at 5:06 PM, Paul Rubin no.email@nospam.invalid wrote: Dan Loewenherz dloewenh...@gmail.com writes: In this case, profile_id is None when the loop breaks. It would be much more straightforward (and more Pythonic, IMO), to write: client = StrictRedis() while

Re: a.index(float('nan')) fails

2012-10-26 Thread Terry Reedy
On 10/25/2012 10:44 PM, Steven D'Aprano wrote: On Thu, 25 Oct 2012 22:04:52 -0400, Terry Reedy wrote: It is a consequence of the following, which some people (but not all) believe is mandated by the IEEE standard. nan = float('nan') nan is nan True The IEEE 754 standard says nothing

Re: a.index(float('nan')) fails

2012-10-26 Thread Terry Reedy
On 10/25/2012 10:19 PM, MRAB wrote: On 2012-10-26 03:04, Terry Reedy wrote: On 10/25/2012 9:46 PM, mambokn...@gmail.com wrote: a = [float('nan'), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] a [nan, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] a.index(float('nan')) This is a second nan object, and it is not in

better way for ' '.join(args) + '\n'?

2012-10-26 Thread Ulrich Eckhardt
Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's join() function, because it avoids repeated reallocations and is at least as expressive as any alternative. What I have now is a case where I'm assembling lines of text for driving a

Re: bit count or bit set Python3

2012-10-26 Thread Antoon Pardon
On 25-10-12 16:47, Charles Hixson wrote: In Python3 is there any good way to count the number of on bits in an integer (after an operation)? Alternatively, is there any VERY light-weight implementation of a bit set? I'd prefer to use integers, as I'm probably going to need thousands of

Re: better way for ' '.join(args) + '\n'?

2012-10-26 Thread Peter Otten
Ulrich Eckhardt wrote: Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's join() function, because it avoids repeated reallocations and is at least as expressive as any alternative. What I have now is a case where I'm assembling

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-26 Thread Janis Papanagnou
Am 26.10.2012 06:45, schrieb Rivka Miller: Thanks everyone, esp this gentleman. Who is this? The solution that worked best for me is just to use a DOT before the string as the one at the beginning of the line did not have any char before it. Which was what I suggested, and where you

Re: better way for ' '.join(args) + '\n'?

2012-10-26 Thread Steven D'Aprano
On Fri, 26 Oct 2012 09:49:50 +0200, Ulrich Eckhardt wrote: Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's join() function, because it avoids repeated reallocations and is at least as expressive as any alternative. What I have now

Re: while expression feature proposal

2012-10-26 Thread Steven D'Aprano
On Fri, 26 Oct 2012 17:23:12 +1100, Chris Angelico wrote: Why is everyone skirting around C-style assignment expressions as though they're simultaneously anathema and the goal? :) Only if your goal is to introduce an anathema :P -- Steven --

Re: Question about long-running web scripts

2012-10-26 Thread Gilles
On Thu, 25 Oct 2012 08:53:11 -0400, David Hutto dwightdhu...@gmail.com wrote: OTOH, Python web scripts can be written as long-running scripts: In this case, what is the added-value of using FastCGI? Why can't the web server simply call the Python script directly, just like CGI? The server

Re: Question about long-running web scripts

2012-10-26 Thread Gilles
On Thu, 25 Oct 2012 14:24:16 +0100, Tim Golden m...@timgolden.me.uk wrote: But actually, I didn't mean one-shot scripts, where the Python interpreter + script must be loaded each time, but rather: If I leave a Python running in an endless loop, why not just use either CGI or some other basic

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-26 Thread Asen Bozhilov
Rivka Miller wrote: I am looking for a regexp for a string not at the beginning of the line. For example, I want to find $hello$ that does not occur at the beginning of the string, ie all $hello$ that exclude ^$hello$. The begging of the string is zero width character. So you could use

RE: Fastest web framework

2012-10-26 Thread Andriy Kornatskyy
Alex, You can read wheezy.web introduction here: http://mindref.blogspot.com/2012/10/wheezy-web-introduction.html Thanks. Andriy Kornatskyy Date: Mon, 15 Oct 2012 18:26:16 -0700 Subject: Re: Fastest web framework From: wuwe...@gmail.com To:

Re: Question about long-running web scripts

2012-10-26 Thread Tim Golden
On 26/10/2012 10:58, Gilles wrote: On Thu, 25 Oct 2012 14:24:16 +0100, Tim Golden m...@timgolden.me.uk wrote: But actually, I didn't mean one-shot scripts, where the Python interpreter + script must be loaded each time, but rather: If I leave a Python running in an endless loop, why not just

Re: Question about long-running web scripts

2012-10-26 Thread Gilles
On Fri, 26 Oct 2012 12:00:17 +0100, Tim Golden m...@timgolden.me.uk wrote: Certainly there are Python equivalents (mod_python, mod_wsgi, etc.) which can run in effectively the same way as mod_php, and they could be configured to run an fcgi frontend script, I presume. There's always a certain

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-26 Thread Ben Bacarisse
Rivka Miller rivkaumil...@gmail.com writes: Thanks everyone, esp this gentleman. Kind of you to single me out, but it was Janis Papanagnou who first posted the solution that you say works best for you. snip -- Ben. -- http://mail.python.org/mailman/listinfo/python-list

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-26 Thread Ed Morton
On 10/25/2012 11:45 PM, Rivka Miller wrote: Thanks everyone, esp this gentleman. The solution that worked best for me is just to use a DOT before the string as the one at the beginning of the line did not have any char before it. That's fine but do you understand that that is not an RE that

Re: Quickie - Regexp for a string not at the beginning of the line

2012-10-26 Thread Joel Goldstick
On Fri, Oct 26, 2012 at 8:32 AM, Ed Morton mortons...@gmail.com wrote: On 10/25/2012 11:45 PM, Rivka Miller wrote: Thanks everyone, esp this gentleman. The solution that worked best for me is just to use a DOT before the string as the one at the beginning of the line did not have any char

Re: bit count or bit set Python3

2012-10-26 Thread Neil Cerutti
On 2012-10-25, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Oct 25, 2012 at 2:00 PM, Neil Cerutti ne...@norwich.edu wrote: Yes indeed! Python string operations are fast enough and its arithmetic slow enough that I no longer assume I can beat a neat lexicographical solution. Try defeating

Escaping from the tedium of naive datetime objects.

2012-10-26 Thread Adam Tauno Williams
Yesterday I stumbled upon a nice solution to dealing with naive datetimes vs. localized datetimes, and much of the tedium that issues from that problem. Maybe this is very common knownledge but it wasn't mentioned in anything I've read - it really cleans up some opertaions.

Re: while expression feature proposal

2012-10-26 Thread Dan Loewenherz
On Thursday, October 25, 2012 11:06:01 PM UTC-7, Paul Rubin wrote: Dan Loewenherz dloewenh...@gmail.com writes: In this case, profile_id is None when the loop breaks. It would be much more straightforward (and more Pythonic, IMO), to write: client = StrictRedis() while

Re: a.index(float('nan')) fails

2012-10-26 Thread Steven D'Aprano
On Fri, 26 Oct 2012 03:54:02 -0400, Terry Reedy wrote: On 10/25/2012 10:44 PM, Steven D'Aprano wrote: On Thu, 25 Oct 2012 22:04:52 -0400, Terry Reedy wrote: It is a consequence of the following, which some people (but not all) believe is mandated by the IEEE standard. nan = float('nan')

Re: while expression feature proposal

2012-10-26 Thread Ian Kelly
On Fri, Oct 26, 2012 at 9:29 AM, Dan Loewenherz dloewenh...@gmail.com wrote: while client.spop(profile_ids) as truthy, profile_id: if not truthy: break print profile_id Here, client.spop returns a tuple, which will always returns true. We then extract the

Re: bit count or bit set Python3

2012-10-26 Thread casevh
On Thursday, October 25, 2012 7:56:25 AM UTC-7, Charles Hixson wrote: In Python3 is there any good way to count the number of on bits in an integer (after an operation)? You may want to look at gmpy2[1] and the popcount() function. Alternatively, is there any VERY light-weight

Re: while expression feature proposal

2012-10-26 Thread Paul Rubin
Dan Loewenherz dloewenh...@gmail.com writes: We also don't special case things like this just because x is an empty string. If this while EXPR as VAR thing were to move forward, we shouldn't treat the truth testing any differently than how we already do. IMO we should write our applications

Re: a.index(float('nan')) fails

2012-10-26 Thread Steven D'Aprano
On Fri, 26 Oct 2012 04:00:03 -0400, Terry Reedy wrote: On 10/25/2012 10:19 PM, MRAB wrote: In summary, .index() looks for an item which is equal to its argument, but it's a feature of NaN (as defined by the standard) that it doesn't equal NaN, therefore .index() will never find it. Except

Re: better way for ' '.join(args) + '\n'?

2012-10-26 Thread Hubert Grünheidt
Hi Ulrich, is this acceptable? args = ['foo', 'bar', 'baz'] args.append('\n') line = ' '.join(args) Cheers, Hubert On 10/26/2012 09:49 AM, Ulrich Eckhardt wrote: Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's

Re: bit count or bit set Python3

2012-10-26 Thread Charles Hixson
cas...@gmail.com wrote: On Thursday, October 25, 2012 7:56:25 AM UTC-7, Charles Hixson wrote: In Python3 is there any good way to count the number of on bits in an integer (after an operation)? You may want to look at gmpy2[1] and the popcount() function. Alternatively, is there any VERY

Re: a.index(float('nan')) fails

2012-10-26 Thread MRAB
On 2012-10-26 17:23, Steven D'Aprano wrote: On Fri, 26 Oct 2012 04:00:03 -0400, Terry Reedy wrote: On 10/25/2012 10:19 PM, MRAB wrote: In summary, .index() looks for an item which is equal to its argument, but it's a feature of NaN (as defined by the standard) that it doesn't equal NaN,

Re: a.index(float('nan')) fails

2012-10-26 Thread Chris Angelico
On Sat, Oct 27, 2012 at 3:23 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In real life, you are *much* more likely to run into these examples of insanity of floats than to be troubled by NANs: - associativity of addition is lost - distributivity of multiplication is lost -

Recommended way to unpack keyword arguments using **kwargs ?

2012-10-26 Thread Jeff Jeffries
I have been doing the following to keep my class declarations short: class MyClass(MyOtherClass): def __init__(self,*args,**kwargs): self.MyAttr = kwargs.get('Attribute',None) #To get a default MyOtherClass.__init__(self,*args,**kwargs) Is there a recommended way to get

Re: Recommended way to unpack keyword arguments using **kwargs ?

2012-10-26 Thread Ian Kelly
On Fri, Oct 26, 2012 at 10:58 AM, Jeff Jeffries jeff.jeffries@gmail.com wrote: I have been doing the following to keep my class declarations short: class MyClass(MyOtherClass): def __init__(self,*args,**kwargs): self.MyAttr = kwargs.get('Attribute',None) #To get a default

Re: a.index(float('nan')) fails

2012-10-26 Thread Steven D'Aprano
On Sat, 27 Oct 2012 03:45:46 +1100, Chris Angelico wrote: On Sat, Oct 27, 2012 at 3:23 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In real life, you are *much* more likely to run into these examples of insanity of floats than to be troubled by NANs: - associativity of

Re: a.index(float('nan')) fails

2012-10-26 Thread Terry Reedy
On 10/26/2012 11:26 AM, Steven D'Aprano wrote: On Fri, 26 Oct 2012 03:54:02 -0400, Terry Reedy wrote: On 10/25/2012 10:44 PM, Steven D'Aprano wrote: On Thu, 25 Oct 2012 22:04:52 -0400, Terry Reedy wrote: It is a consequence of the following, which some people (but not all) believe is

[ANN] pypiserver 1.0.0 - minimal private pypi server

2012-10-26 Thread Ralf Schmitt
Hi, I've just uploaded pypiserver 1.0.0 to the python package index. pypiserver is a minimal PyPI compatible server. It can be used to serve a set of packages and eggs to easy_install or pip. pypiserver is easy to install (i.e. just 'pip install pypiserver'). It doesn't have any external

Re: a.index(float('nan')) fails

2012-10-26 Thread Terry Reedy
On 10/26/2012 12:23 PM, Steven D'Aprano wrote: On Fri, 26 Oct 2012 04:00:03 -0400, Terry Reedy wrote: This inconsistency is an intentional decision to not propagate the insanity of nan != nan to Python collections. That's a value judgement about NANs which is not shared by everyone. Quite

Re: a.index(float('nan')) fails

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 2:40 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The problem isn't with the associativity, it's with the equality comparison. Replace x == y with abs(x-y)epsilon for some epsilon and all your statements fulfill people's expectations. O RYLY? Would

Re: better way for ' '.join(args) + '\n'?

2012-10-26 Thread Tycho Andersen
On Fri, Oct 26, 2012 at 09:49:50AM +0200, Ulrich Eckhardt wrote: Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's join() function, because it avoids repeated reallocations and is at least as expressive as any alternative. What I

Re: better way for ' '.join(args) + '\n'?

2012-10-26 Thread Dave Angel
On 10/26/2012 05:26 PM, Tycho Andersen wrote: On Fri, Oct 26, 2012 at 09:49:50AM +0200, Ulrich Eckhardt wrote: Hi! General advise when assembling strings is to not concatenate them repeatedly but instead use string's join() function, because it avoids repeated reallocations and is at least

Re: better way for ' '.join(args) + '\n'?

2012-10-26 Thread Tycho Andersen
On Fri, Oct 26, 2012 at 05:36:50PM -0400, Dave Angel wrote: On 10/26/2012 05:26 PM, Tycho Andersen wrote: Assuming it's the length of the list that's the problem, not the length of the strings in the list... args = ['foo', 'bar', 'baz'] args[-1] = args[-1] + '\n' line = ' '.join(args)

Re: How to set 250000 baud rate in pyserial ?

2012-10-26 Thread kurabas
Error is like cannot set special baud rate. But as I said pyserial set this speed without problem for ttyUSB0 So it seems pyserial uses diefferent code depending of port type. I tried to simlink ln -s ttyACM0 ttyUSB0 but it does not work On Thursday, October 25, 2012 9:11:23 PM UTC+3, Dennis

Re: while expression feature proposal

2012-10-26 Thread Cameron Simpson
On 26Oct2012 09:10, Paul Rubin no.email@nospam.invalid wrote: | However, if the as can be part of an expression as in Chris Angelico's | post, Chris's suggestion | | while (client.spop(profile_ids) as profile_id) is not None: | print profile_id | | looks good to me. Now this pulls

Re: How to set 250000 baud rate in pyserial ?

2012-10-26 Thread Michael Torrie
On 10/26/2012 04:01 PM, kura...@gmail.com wrote: Error is like cannot set special baud rate. But as I said pyserial set this speed without problem for ttyUSB0 So it seems pyserial uses diefferent code depending of port type. I tried to simlink ln -s ttyACM0 ttyUSB0 but it does not work No

Re: while expression feature proposal

2012-10-26 Thread Ian Kelly
On Fri, Oct 26, 2012 at 4:03 PM, Cameron Simpson c...@zip.com.au wrote: It will work anywhere an expression is allowed, and superficially doesn't break stuff that exists if as has the lowest precedence. Please, no. There is no need for it outside of while expressions, and anywhere else it's

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 1:12 AM, Dan Loewenherz dloewenh...@gmail.com wrote: It seems the topic of this thread has changed drastically from the original message. 1) while EXPR as VAR in no way says that EXPR must be a boolean value. In fact, a use case I've run into commonly in web

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 2:23 AM, Chris Angelico ros...@gmail.com wrote: while (client.spop(profile_ids) as profile_id) is not None: print profile_id Why is everyone skirting around C-style assignment expressions as though they're simultaneously anathema and the goal? :) Why should these

Re: while expression feature proposal

2012-10-26 Thread Tim Chase
On 10/26/12 17:03, Cameron Simpson wrote: On 26Oct2012 09:10, Paul Rubin no.email@nospam.invalid wrote: | while (client.spop(profile_ids) as profile_id) is not None: Now this pulls me from a -0 to a +0.5. Any doco would need to make it clear that no order of operation is implied, so

Re: SSH Connection with Python

2012-10-26 Thread Gelonida N
On 10/25/2012 12:47 PM, Kamlesh Mutha wrote: You can use paramiko module. Very easy to use. I also use paramiko for a small script. However I'm a little hesitant to use paramik for new code. The web page says: last updated 21-May-2011 and the github url http://github.com/robey/paramiko/

Re: while expression feature proposal

2012-10-26 Thread Dan Loewenherz
On Fri, Oct 26, 2012 at 4:12 PM, Devin Jeanpierre jeanpierr...@gmail.comwrote: For loops are pythonic. You can do this in Python today: client = StrictRedis() for profile_id in iter(lambda: client.spop(profile_ids), None): pass I would like a better iter(), rather than a

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 6:03 PM, Cameron Simpson c...@zip.com.au wrote: Any doco would need to make it clear that no order of operation is implied, so that this: x = 1 y = (2 as x) + x does not have a defined answer; might be 2, might be 3. Just like any other function call with side

Re: while expression feature proposal

2012-10-26 Thread Cameron Simpson
On 26Oct2012 19:41, Devin Jeanpierre jeanpierr...@gmail.com wrote: | On Fri, Oct 26, 2012 at 6:03 PM, Cameron Simpson c...@zip.com.au wrote: | Any doco would need to make it clear that no order of operation is | implied, so that this: | |x = 1 |y = (2 as x) + x | | does not have a

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 7:41 PM, Dan Loewenherz dloewenh...@gmail.com wrote: -- snip insanity -- But this is yucky. I'd much rather have something a bit more clear to the reader. That's why I said I wanted a better iter, not some equality-overriding object strawman thing. I was thinking more

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 7:56 PM, Cameron Simpson c...@zip.com.au wrote: No. Separate _expressions_ are evaluated left to right. So this: f(1), f(2) calls f(1) first, then f(2). But this: f(1) + f(2) need not do so. Counter-documentation welcomed, but the doco you cite does not

Re: while expression feature proposal

2012-10-26 Thread Cameron Simpson
On 26Oct2012 18:26, Tim Chase s...@thechases.com wrote: | On 10/26/12 17:03, Cameron Simpson wrote: | On 26Oct2012 09:10, Paul Rubin no.email@nospam.invalid wrote: | | while (client.spop(profile_ids) as profile_id) is not None: | | Now this pulls me from a -0 to a +0.5. | | Any doco

Re: while expression feature proposal

2012-10-26 Thread Cameron Simpson
On 27Oct2012 10:56, I wrote: | On 26Oct2012 19:41, Devin Jeanpierre jeanpierr...@gmail.com wrote: | | But function calls with side effects _do_ have a defined order of | | evaluation. Left to right. | | And the answer should be 4. | |

Re: while expression feature proposal

2012-10-26 Thread Cameron Simpson
On 26Oct2012 16:48, Ian Kelly ian.g.ke...@gmail.com wrote: | On Fri, Oct 26, 2012 at 4:03 PM, Cameron Simpson c...@zip.com.au wrote: | It will work anywhere an expression is allowed, and superficially | doesn't break stuff that exists if as has the lowest precedence. | | Please, no. There is

Re: while expression feature proposal

2012-10-26 Thread Steven D'Aprano
On Fri, 26 Oct 2012 19:12:17 -0400, Devin Jeanpierre wrote: I would like a better iter(), rather than a better while loop. It is irritating to pass in functions that take arguments, and it is impossible to, say, pass in functions that should stop being iterated over when they return _either_

Re: while expression feature proposal

2012-10-26 Thread Cameron Simpson
On 26Oct2012 19:19, Devin Jeanpierre jeanpierr...@gmail.com wrote: | (I've always been partial to :=, personally.) I'm less so. It is hard to type (on my keyboard anyway, that's a shifted keystroke followed by an unshifted one). I mank that up often enough that I would resent it for something as

Re: SSH Connection with Python

2012-10-26 Thread Roy Smith
In article mailman.2915.1351294793.27098.python-l...@python.org, Gelonida N gelon...@gmail.com wrote: Another problem is, that paramiko depends on pycrypto 2.1+ which doesn't exist as binary release for python 2.7 I'm running paramiko-1.7.6 with python 2.7.3 on my Ubunto Precise box. I'm

Re: while expression feature proposal

2012-10-26 Thread Devin Jeanpierre
On Fri, Oct 26, 2012 at 8:18 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I would like a better iter(), rather than a better while loop. It is irritating to pass in functions that take arguments, and it is impossible to, say, pass in functions that should stop being iterated

Re: while expression feature proposal

2012-10-26 Thread Chris Angelico
On Sat, Oct 27, 2012 at 10:19 AM, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Fri, Oct 26, 2012 at 2:23 AM, Chris Angelico ros...@gmail.com wrote: while (client.spop(profile_ids) as profile_id) is not None: print profile_id Why is everyone skirting around C-style assignment

how to change os.popen4 to subprocess

2012-10-26 Thread skyworld
Hi, I'm new to python and I'm trying to porting some scripts from v0.96 to v2.0.1. A piece of code is like this: cmd_h = os.popen4(env['SYSCMDLINE'])[1] the system indicates the popen4 is deprecated and suggest to use subprocess. Can anybody tell me how to use subprocess in this case? and what

attaching names to subexpressions

2012-10-26 Thread Steve Howell
I have been reading the thread while expression feature proposal, and one of the interesting outcomes of the thread is the idea that Python could allow you to attach names to subexpressions, much like C allows. In C you can say something like this: tax_next_year = (new_salary = salary * (1 +

Re: how to change os.popen4 to subprocess

2012-10-26 Thread MRAB
On 2012-10-27 03:28, skyworld wrote: Hi, I'm new to python and I'm trying to porting some scripts from v0.96 to v2.0.1. A piece of code is like this: cmd_h = os.popen4(env['SYSCMDLINE'])[1] the system indicates the popen4 is deprecated and suggest to use subprocess. Can anybody tell me how to

Re: how to change os.popen4 to subprocess

2012-10-26 Thread Mark Lawrence
On 27/10/2012 03:28, skyworld wrote: Hi, I'm new to python and I'm trying to porting some scripts from v0.96 to v2.0.1. A piece of code is like this: What software are you talking about here, it's certainly not Python versions as the most up to date are 2.7.3 and 3.3.0? cmd_h =

Re: while expression feature proposal

2012-10-26 Thread Paul Rubin
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: There's no need for it *inside* of while expressions. It doesn't add to the expressiveness of the language, or increase the power of the language, or help people write correct code. It saves one trivial line of code in some, but

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-26 Thread Charles-François Natali
Charles-François Natali added the comment: No automated testing included because I'm not entirely sure how to replicate this without eating up a ton of ram or doing something naughty with ulimit. Simply use RLIMIT_NPROC, from a subprocess: $ cat /tmp/test.py import subprocess ps = [ ] for

[issue16271] weird dual behavior with changing __qualname__; different values observed through attribute and descriptor

2012-10-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Here's a patch for 3.4. __qualname__ ought to have been implemented this way in the first place. I'll have to think about what can be done about 3.3. Maybe just the same fix without the removal of PyHeapType.ht_qualname. We can hope no one has written

[issue16271] weird dual behavior with changing __qualname__; different values observed through attribute and descriptor

2012-10-26 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm not sure why this would be the correct way to do it. First you are removing the unicode check, which looks wrong to me. Second, if ht_name works, perhaps ht_qualname can be made to work as well? -- ___ Python

[issue16285] Update urllib to RFC 3986

2012-10-26 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16285 ___ ___ Python-bugs-list

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-26 Thread STINNER Victor
STINNER Victor added the comment: sys.getfilesystemencoding() 'mbcs' import locale locale.getpreferredencoding() 'cp932' 'cp932' is the same as 'mbcs' in the Japanese environment. And what is the value.of locale.getpreferredencoding(False)? --

[issue16309] PYTHONPATH= different from no PYTHONPATH at all

2012-10-26 Thread Chris Rebert
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16309 ___ ___ Python-bugs-list

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-26 Thread Charles-François Natali
Charles-François Natali added the comment: Also, I didn't check, but if the problems also occurs on execve() failure, then it's much simpler: simply call Popen() with an invalid/nonexisting executable. -- ___ Python tracker rep...@bugs.python.org

[issue15494] Move test/support.py into a test.support subpackage

2012-10-26 Thread Nick Coghlan
Nick Coghlan added the comment: This whole refactoring project grew out of the fact that Chris and I were looking for somewhere to put common helpers for package testing. Specfically, I wrote a heap of helpers for test_runpy that I wanted to use for the new pkgutil tests. The short term hack

[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2012-10-26 Thread Masami HIRATA
Masami HIRATA added the comment: And what is the value.of locale.getpreferredencoding(False)? import locale locale.getpreferredencoding(False) 'cp932' -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16322

[issue15498] Eliminate the use of deprecated OS X APIs in getpath.c

2012-10-26 Thread Ronald Oussoren
Ronald Oussoren added the comment: Apple seems to have switched to using dlopen in their version of getpath.c (see http://www.opensource.apple.com/source/python/python-60.3/2.7/fix/getpath.c.ed, this is the version in OSX 10.8.2) This causes a problem for some people, as noticed on the

[issue16313] Support xz compression in shutil module

2012-10-26 Thread Hynek Schlawack
Hynek Schlawack added the comment: Isn’t this a dupe of #5411? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16313 ___ ___ Python-bugs-list

[issue16313] Support xz compression in shutil module

2012-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, this is actually a dupe of #5411? Thanks. -- resolution: - duplicate stage: patch review - committed/rejected status: open - closed superseder: - Add xz support to shutil ___ Python tracker

[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-10-26 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: -berker.peksag ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9856 ___ ___

[issue5411] Add xz support to shutil

2012-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I have not seen this issue and was created a new issue16313 with almost same patch as Eric's one (only I have changed the documentation too). Here's the patch. I wonder that it was not committed yet to 3.3. I think it would be better first to add xz support

[issue5411] Add xz support to shutil

2012-10-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5411 ___ ___

[issue11468] Improve unittest basic example in the doc

2012-10-26 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: -berker.peksag ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11468 ___ ___

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-26 Thread Jesús Cea Avión
Jesús Cea Avión added the comment: The problem with using RLIMIT is that the testsuite could be executing several tests in parallel using independent threads, for instance. You don't want to influence unrelated tests. Overiding private methods is ugly, but if the code evolves the test would

[issue5411] Add xz support to shutil

2012-10-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file27722/shutil-lzma.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5411 ___

[issue5411] Add xz support to shutil

2012-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Oh, I see the '.bz2' bug. Patch updated. -- Added file: http://bugs.python.org/file27723/shutil-lzma_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5411

[issue16307] multiprocess.pool.map_async callables not working

2012-10-26 Thread Hynek Schlawack
Hynek Schlawack added the comment: Thanks for taking the time! I remember my frustrations when trying to grok how the mp test suite works. :) A small nit-pick first: you have a lot of extra white space in your patches. Just run 'make patchcheck' first, that should warn you about that. Not

[issue15222] mailbox.mbox writes without empty line after each message

2012-10-26 Thread lilydjwg
lilydjwg added the comment: My system has updated to Python 3.3.0 and this bugs me again :-( I don't see the changes in Python 3.3.0. So when will this be merged into 3.3? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15222

[issue15222] mailbox.mbox writes without empty line after each message

2012-10-26 Thread Petri Lehtinen
Petri Lehtinen added the comment: The fix was committed when 3.3.0 was in release candidate mode, and wasn't considered important enough to be included in 3.3.0 anymore. It will be included in 3.3.1, which is to be released next month. -- ___

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-26 Thread Charles-François Natali
Charles-François Natali added the comment: The problem with using RLIMIT is that the testsuite could be executing several tests in parallel using independent threads, for instance. You don't want to influence unrelated tests. That's why I suggested to run it in a subprocess: this is used

[issue16307] multiprocess.pool.map_async callables not working

2012-10-26 Thread Janne Karila
Janne Karila added the comment: Otherwise I agree, but what if one of the callbacks is not called? The test case would fail on assertEqual(2, len(call_args)) but you wouldn't know which callback is the problem. -- ___ Python tracker

[issue4202] Multiple interpreters and readline module hook functions.

2012-10-26 Thread Winston451
Winston451 added the comment: I attached a patch that solve the problem -- keywords: +patch Added file: http://bugs.python.org/file27725/readline.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4202

[issue16324] MIMEText __init__ does not support Charset instance

2012-10-26 Thread Claude Paroz
Changes by Claude Paroz cla...@2xlibre.net: -- keywords: +patch Added file: http://bugs.python.org/file27726/issue16324-1.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16324 ___

[issue4202] Multiple interpreters and readline module hook functions.

2012-10-26 Thread Winston451
Changes by Winston451 montag...@laposte.net: -- type: - behavior versions: +Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4202

[issue4202] Multiple interpreters and readline module hook functions.

2012-10-26 Thread Winston451
Changes by Winston451 montag...@laposte.net: Added file: http://bugs.python.org/file27727/readline.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4202 ___

[issue4202] Multiple interpreters and readline module hook functions.

2012-10-26 Thread Winston451
Changes by Winston451 montag...@laposte.net: Removed file: http://bugs.python.org/file27725/readline.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4202 ___

[issue16328] win_add2path.py sets wrong user path

2012-10-26 Thread Emil Styrke
New submission from Emil Styrke: OS: Windows 7 Ultimate x64 Python version: 2.7.3 x64 win_add2path.py in the scripts directory is supposed to add the Scripts directory according to its source. However, it tries to add $PYTHONPATH/Scripts, when in fact the Scripts directory is at

[issue16307] multiprocess.pool.map_async callables not working

2012-10-26 Thread Hynek Schlawack
Hynek Schlawack added the comment: True, it makes sense to push this assert to the end. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16307 ___

  1   2   >