GOTCHA with list comprehension

2015-08-05 Thread Pavel S
Hi, I recently found interesting GOTCHA while doing list comprehension in python 2.6: values = ( True, False, 1, 2, 3, None ) [ value for value in values if value if not None ] [True, 1, 2, 3] I was wondering why this list comprehension returns incorrect results and finally found a typo in

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Lele Gaifax
Rustom Mody rustompm...@gmail.com writes: Does yaml have comments? Yes, the same syntax as Python's. ciao, lele. -- nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia. l...@metapensiero.it | --

Re: GOTCHA with list comprehension

2015-08-05 Thread Pavel S
It seems this is allowed by the grammar: list_display::= [ [expression_list | list_comprehension] ] list_comprehension ::= expression list_for list_for::= for target_list in old_expression_list [list_iter] old_expression_list ::= old_expression [(, old_expression)+ [,]]

Re: GOTCHA with list comprehension

2015-08-05 Thread Chris Angelico
On Wed, Aug 5, 2015 at 4:48 PM, Pavel S pa...@schon.cz wrote: Hi, I recently found interesting GOTCHA while doing list comprehension in python 2.6: values = ( True, False, 1, 2, 3, None ) [ value for value in values if value if not None ] [True, 1, 2, 3] I was wondering why this list

Re: GOTCHA with list comprehension

2015-08-05 Thread Peter Otten
Pavel S wrote: Hi, I recently found interesting GOTCHA while doing list comprehension in python 2.6: values = ( True, False, 1, 2, 3, None ) [ value for value in values if value if not None ] [True, 1, 2, 3] I was wondering why this list comprehension returns incorrect results and

Re: GOTCHA with list comprehension

2015-08-05 Thread Pavel S
$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago) $ python --version Python 2.6.6 Incidentally, why Python 2.6? ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: GOTCHA with list comprehension

2015-08-05 Thread Chris Angelico
On Wed, Aug 5, 2015 at 5:03 PM, Pavel S pa...@schon.cz wrote: It seems this is allowed by the grammar: list_display::= [ [expression_list | list_comprehension] ] list_comprehension ::= expression list_for list_for::= for target_list in old_expression_list [list_iter]

Re: GOTCHA with list comprehension

2015-08-05 Thread Chris Angelico
On Wed, Aug 5, 2015 at 5:10 PM, Pavel S pa...@schon.cz wrote: $ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.5 (Santiago) $ python --version Python 2.6.6 Incidentally, why Python 2.6? I guess that would be why :) That's probably actually a patched 2.6.6 - from what I

Re: GOTCHA with list comprehension

2015-08-05 Thread Pavel S
Hi Chris, yeah, I have to stick on the software which my employer provides to me (we're enterprise company). I'm not root on that system. I'm happy with 2.6 now, two years ago we were on older RHEL with python 2.4 and it was a real pain :) $ cat /etc/redhat-release Red Hat Enterprise Linux

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Steven D'Aprano
On Wednesday 05 August 2015 05:59, Ben Finney wrote: marco.naw...@colosso.nl writes: Why not use Python files itself as configuration files? Because configuration data will be user-editable. (If it's not user-editable, that is itself a poor design choice.) If you allow executable code

Re: GOTCHA with list comprehension

2015-08-05 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: You can chain 'for' and 'if' clauses as much as you like, and they behave exactly the way you'd expect. How do you know what I'd expect? I wouldn't know what to expect myself. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: GOTCHA with list comprehension

2015-08-05 Thread Chris Angelico
On Wed, Aug 5, 2015 at 7:01 PM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: You can chain 'for' and 'if' clauses as much as you like, and they behave exactly the way you'd expect. How do you know what I'd expect? I wouldn't know what to expect myself. A list

Problem in IDLE setup

2015-08-05 Thread Ahsan Chauhan
Respected Sir/Madam, I would like to bring it to your notice that IDLE's executable file is not working properly in Python3.5.0. So please look into this. Regards Ahsan Chauhan -- https://mail.python.org/mailman/listinfo/python-list

consumer/producer with asyncio

2015-08-05 Thread David Rios
Hello everyone, I'm trying to implement a producer/consumer using asyncio, but I have some doubts about the best way to do it. I already have a working implementation using threads, and want to port it to asyncio for fun, to learn and also to avoid some problems that I have using threads, namely

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Chris Angelico
On Wed, Aug 5, 2015 at 6:32 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: My own personal feeling is that using code as config is a little disquieting. It's a bit of a code smell. Do you really need that much power just to allow people to set some configuration settings? Using

Re: Uninstall

2015-08-05 Thread Mark Lawrence
On 05/08/2015 02:51, Mario Figueiredo wrote: [chopped to pieces] On Tue, Aug 4, 2015 at 9:01 PM, Mark Lawrence breamore...@yahoo.co.uk mailto:breamore...@yahoo.co.uk wrote: On 04/08/2015 19:31, sohcahto...@gmail.com mailto:sohcahto...@gmail.com wrote: On Tuesday, August 4, 2015

Re: Linux script to get most expensive processes

2015-08-05 Thread Thomas 'PointedEars' Lahn
Cecil Westerhof wrote: Under Linux I like to get the most expensive processes. The two most useful commands are: ps -eo pid,user,pcpu,args --sort=-pcpu and: ps -eo pid,user,pcpu,args --sort=-vsize In my case I am only interested in the seven most expensive processes. For this I

Re: Uninstall

2015-08-05 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote: On 04/08/2015 19:31, sohcahto...@gmail.com wrote: I really fucking hate how pedantic some of the people on this mailing list are. milos wasn't wrong. You just chose to take his message too literally. I thought it was pretty clear that when milos said can't, he really

Re: GOTCHA with list comprehension

2015-08-05 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: On Wed, Aug 5, 2015 at 7:01 PM, Marko Rauhamaa ma...@pacujo.net wrote: Chris Angelico ros...@gmail.com: You can chain 'for' and 'if' clauses as much as you like, and they behave exactly the way you'd expect. How do you know what I'd expect? I wouldn't

Re: Problem in IDLE setup

2015-08-05 Thread Mark Lawrence
On 04/08/2015 12:31, Ahsan Chauhan wrote: Respected Sir/Madam, I would like to bring it to your notice that IDLE's executable file is not working properly in Python3.5.0. So please look into this. Regards Ahsan Chauhan Please state exactly what you're tried to do, what you expected to

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Tim Chase
On 2015-08-02 12:11, Cecil Westerhof wrote: There are a lot of ways to store configuration information: - conf file - xml file - database - json file - and possible a lot of other ways I want to write a Python program to display cleaned log files. I do not think I need a lot of

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Rustom Mody
On Wednesday, August 5, 2015 at 6:58:01 PM UTC+5:30, Tim Chase wrote: On 2015-08-02 12:11, Cecil Westerhof wrote: There are a lot of ways to store configuration information: - conf file - xml file - database - json file - and possible a lot of other ways I want to write a Python

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Rustom Mody
On Sunday, August 2, 2015 at 3:44:51 PM UTC+5:30, Cecil Westerhof wrote: There are a lot of ways to store configuration information: - conf file - xml file - database - json file - and possible a lot of other ways One that I dont think has been mentioned: ast.literal_eval --

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Grant Edwards
On 2015-08-05, Michael Torrie torr...@gmail.com wrote: On 08/04/2015 01:59 PM, Ben Finney wrote: marco.naw...@colosso.nl writes: Why not use Python files itself as configuration files? Because configuration data will be user-editable. (If it's not user-editable, that is itself a poor

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Steven D'Aprano
On Wed, 5 Aug 2015 11:46 pm, Rustom Mody wrote: On Sunday, August 2, 2015 at 3:44:51 PM UTC+5:30, Cecil Westerhof wrote: There are a lot of ways to store configuration information: - conf file - xml file - database - json file - and possible a lot of other ways One that I dont think has

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Rustom Mody
On Wednesday, August 5, 2015 at 7:38:46 PM UTC+5:30, Steven D'Aprano wrote: On Wed, 5 Aug 2015 11:46 pm, Rustom Mody wrote: On Sunday, August 2, 2015 at 3:44:51 PM UTC+5:30, Cecil Westerhof wrote: There are a lot of ways to store configuration information: - conf file - xml file -

Is this an example of tail recursion?

2015-08-05 Thread jennyfurtado2
I am trying to learn differences between tail recursion and non tail recursion. Is the following recursive code tail recursive? If it is not how to convert it to tail recursion? If it is how to convert it to non tail recursion? class CastleDefenseI: INFINITY = 9 def

Re: Is this an example of tail recursion?

2015-08-05 Thread Rustom Mody
On Wednesday, August 5, 2015 at 8:43:31 PM UTC+5:30, jennyf...@gmail.com wrote: I am trying to learn differences between tail recursion and non tail recursion. Is the following recursive code tail recursive? If it is not how to convert it to tail recursion? If it is how to convert it to

Re: Is this an example of tail recursion?

2015-08-05 Thread jennyfurtado2
On Wednesday, August 5, 2015 at 9:21:33 AM UTC-6, Rustom Mody wrote: On Wednesday, August 5, 2015 at 8:43:31 PM UTC+5:30, jennyf...@gmail.com wrote: I am trying to learn differences between tail recursion and non tail recursion. Is the following recursive code tail recursive? If it

Re: Is this an example of tail recursion?

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 1:13 AM, jennyfurta...@gmail.com wrote: I am trying to learn differences between tail recursion and non tail recursion. Tail recursion is where you do exactly this: return some_function(...) Absolutely nothing is allowed to happen around or after that function,

Re: Is this an example of tail recursion?

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 1:37 AM, jennyfurta...@gmail.com wrote: Sorry I am missing a subtle point: Isnt 1+ self.soldiersVsDefenders... ending up calling 1.__add__(self.soldiersVsDefenders...)? I think his point is that it is, in effect, doing that; but honestly, calling this a tail call into

Re: Is this an example of tail recursion?

2015-08-05 Thread jenny
On Wednesday, August 5, 2015 at 9:52:14 AM UTC-6, Chris Angelico wrote: On Thu, Aug 6, 2015 at 1:13 AM, jennyfurta...@gmail.com wrote: I am trying to learn differences between tail recursion and non tail recursion. Tail recursion is where you do exactly this: return

Re: Is this an example of tail recursion?

2015-08-05 Thread Rustom Mody
On Wednesday, August 5, 2015 at 9:07:52 PM UTC+5:30, jennyf...@gmail.com wrote: On Wednesday, August 5, 2015 at 9:21:33 AM UTC-6, Rustom Mody wrote: On Wednesday, August 5, 2015 at 8:43:31 PM UTC+5:30, jennyf...@gmail.com wrote: I am trying to learn differences between tail recursion and

Re: Is this an example of tail recursion?

2015-08-05 Thread jennyfurtado2
On Wednesday, August 5, 2015 at 10:10:22 AM UTC-6, Rustom Mody wrote: On Wednesday, August 5, 2015 at 9:07:52 PM UTC+5:30, jennyf...@gmail.com wrote: On Wednesday, August 5, 2015 at 9:21:33 AM UTC-6, Rustom Mody wrote: On Wednesday, August 5, 2015 at 8:43:31 PM UTC+5:30,

Re: Is this an example of tail recursion?

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 2:10 AM, Rustom Mody rustompm...@gmail.com wrote: 1 + x does not *call* 1 .__add__(x) It *is* that [Barring corner cases of radd etc] IOW I am desugaring the syntax into explicit method-calls so you can see all the calls explicitly Then it becomes evident -- visibly

How to trace the recursive path?

2015-08-05 Thread jennyfurtado2
Consider this code (shown in my previous post) class CastleDefenseI: INFINITY = 9 def __init__(self): self.dpw = 0 def soldiersVsDefenders(self,soldiers,defenders): # soldiers win if defenders =0: return 0 # castle/defenders win

Re: Is this an example of tail recursion?

2015-08-05 Thread jennyfurtado2
On Wednesday, August 5, 2015 at 10:29:21 AM UTC-6, Chris Angelico wrote: On Thu, Aug 6, 2015 at 2:10 AM, Rustom Mody rustompm...@gmail.com wrote: 1 + x does not *call* 1 .__add__(x) It *is* that [Barring corner cases of radd etc] IOW I am desugaring the syntax into explicit method-calls

Re: Is this an example of tail recursion?

2015-08-05 Thread Rustom Mody
On Wednesday, August 5, 2015 at 10:11:30 PM UTC+5:30, wrote: On Wednesday, August 5, 2015 at 10:29:21 AM UTC-6, Chris Angelico wrote: On Thu, Aug 6, 2015 at 2:10 AM, Rustom Mody wrote: 1 + x does not *call* 1 .__add__(x) It *is* that [Barring corner cases of radd etc] IOW I am

Re: Is this an example of tail recursion?

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 2:51 AM, Rustom Mody rustompm...@gmail.com wrote: And I continue to have no idea what Chris is talking about. Here is C printf from ctypes import * cdll.LoadLibrary(libc.so.6) libc = CDLL(libc.so.6) libc.printf(b%s, bHello) 5 Hello As far as I can see printf is a C

Installation Successful, but pythonw and idle doesn't function

2015-08-05 Thread Rick Smith
I was able to install various versions of Python (3.5.0b4 32bit being the most recent) multiple times (uninstalling in between) and they worked (python --version at the command line worked). However pythonw.exe did not and does not work. I was simply returned to the command prompt, without

QUEST: does HACKING make FOR loop quicker.

2015-08-05 Thread John Doe
Presumption 1. Lists are mutable sequences. 2. There is a subtlety when the sequence is being modified by the FOR loop (this can only occur for mutable sequences, i.e. lists) Preamble

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Tim Chase
On 2015-08-05 06:37, Rustom Mody wrote: config = {} with open('config.ini') as f: for row in f: row = row.strip() if not row or row.startswith(('#', ';')): continue k, _, v = row.partition('=') config[k.strip().upper()] = v.lstrip()

Looking for OpenStack Developer

2015-08-05 Thread Pranesh Srinivasan
Hi, Hope you are doing well !!! My name is Siva and I'm a recruiter at TheAppliedthought , a global staffing and IT consulting company. Please find the below job description which may suits any of your consultants who are available in market or who are looking for change, please send me latest

Re: QUEST: does HACKING make FOR loop quicker.

2015-08-05 Thread Mark Lawrence
On 05/08/2015 21:00, John Doe wrote: Three strikes and you're out, good bye troll. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Marko Rauhamaa
Tim Chase python.l...@tim.thechases.com: There's a certain simplicity to simply having key/value pairs separated by an = and then letting the application do whatever it needs/wants with those key/value strings. That trap has lured in a lot of wildlife. What to do with lists? Is whitespace

Re: Installation Successful, but pythonw and idle doesn't function

2015-08-05 Thread Thomas 'PointedEars' Lahn
Rick Smith wrote: However pythonw.exe did not and does not work. I was simply returned to the command prompt, without ANY interaction or error. promptpythonw prompt Works as designed. You are proceeding from a false assumption. pythonw.exe is not meant to provide an interactive

Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Terry Reedy
There have been discussions, such as today on Idle-sig , about who uses Idle and who we should design it for. If you use Idle in any way, or know of or teach classes using Idle, please answer as many of the questions below as you are willing, and as are appropriate Private answers are

[issue24800] exec docs should note that the no argument form in a local scope is really the two argument form

2015-08-05 Thread eryksun
eryksun added the comment: If exec gets two separate objects as globals and locals, the code will be executed as if it were embedded in a class definition. Probably there needs to be more clarification of the compilation context. Class definitions support lexical closures, whereas source

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Rustom Mody
On Thursday, August 6, 2015 at 6:32:03 AM UTC+5:30, Rustom Mody wrote: By contrast here is a more friendly error message (had put a comma where a colon required) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.4/ast.py, line 46, in literal_eval

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Paul Rubin
Terry Reedy tjre...@udel.edu writes: There have been discussions, such as today on Idle-sig , about who uses Idle and who we should design it for. I use it sometimes. I mostly use Emacs with Python-mode but find Idle is nice for quickly experimenting with something or probing an API. I know

Re: Installation Successful, but pythonw and idle doesn't function

2015-08-05 Thread Zachary Ware
Hi Rick, On Wed, Aug 5, 2015 at 11:12 AM, Rick Smith pyt...@activemail.us wrote: I was able to install various versions of Python (3.5.0b4 32bit being the most recent) multiple times (uninstalling in between) and they worked (python --version at the command line worked). However pythonw.exe

[issue21279] str.translate documentation incomplete

2015-08-05 Thread Zachary Ware
Zachary Ware added the comment: Very minor grammatical fixes, reflowed the .rst docs, and re-added the codecs module mention in a less obtrusive manner, but the patch is committed. Thank you Kinga, Martin, and John! -- nosy: +zach.ware ___ Python

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Paul Rubin
Paul Rubin no.email@nospam.invalid writes: I use it sometimes. I mostly use Emacs with Python-mode but find Idle is nice for quickly experimenting with something or probing an API. Added: I sometimes used Idle in places where Emacs isn't available, e.g. client machines running Windows. It's

Re: Installation Successful, but pythonw and idle doesn't function

2015-08-05 Thread Terry Reedy
On 8/5/2015 6:09 PM, Thomas 'PointedEars' Lahn wrote: Rick Smith wrote: I also attempted to run idle, with the following results: C: \Users\judy\AppData\Local\Programs\Python\Python35-32\Lib\idlelibidle.py ** IDLE can't import Tkinter. Your Python may not be configured for Tk.

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Laura Creighton
In a message of Wed, 05 Aug 2015 21:06:31 -0400, Terry Reedy writes: 0. Classes where Idle is used: Where -- my house or sometimes at the board game society Level -- beginners and there are 8 children right now. Idle users: 1. Are you I am post graduate, but the kids are all grade school. 2.

[issue21279] str.translate documentation incomplete

2015-08-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset ae53bd5decae by Zachary Ware in branch '3.4': Issue #21279: Flesh out str.translate docs https://hg.python.org/cpython/rev/ae53bd5decae New changeset 064b569e38fe by Zachary Ware in branch '3.5': Issue #21279: Merge with 3.4

[issue24802] PyFloat_FromString Buffer Over-read

2015-08-05 Thread John Leitch
New submission from John Leitch: Python suffers from a buffer over-read in PyFloat_FromString() that is caused by the incorrect assumption that buffers returned by PyObject_GetBuffer() are null-terminated. This could potentially result in the disclosure of adjacent memory. PyObject *

[issue24787] csv.Sniffer guesses M instead of \t or , as the delimiter

2015-08-05 Thread Skip Montanaro
Skip Montanaro added the comment: Tiago, sorry, but your last post with results is completely unintelligible. Can you toss the table in a file and attach it instead? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24787

[issue24800] exec docs should note that the no argument form in a local scope is really the two argument form

2015-08-05 Thread R. David Murray
R. David Murray added the comment: OK, yes, so a class body at global scope or something like that :) LOAD_CLASSDEREF is another whole level of complication to the scoping weirdness for classes; see issue 19979 and issue 24129. -- ___ Python

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Miki Tebeka
Greetings, 0. Classes where Idle is used: Where? At client site. Mostly big companies. Level? From beginner to advanced. Idle users: 1. Are you grade school (1=12)? undergraduate (Freshman-Senior)? post-graduate (from whatever)? post-graduate 2. Are you beginner (1st class, maybe 2nd

[issue24804] https://www.python.org/ftp/python/2.7.4/python-2.7.4.msi actually installs 2.7.7

2015-08-05 Thread Zachary Ware
Zachary Ware added the comment: The report is almost certainly not accurate and is probably a result of trying to install 2.7.4 on top of 2.7.7, which will not work (the 2.7.7 python27.dll is newer and not overwritten). Either way, neither version is supported anymore. --

[issue23672] IDLE can crash if file name contains non-BMP Unicode characters

2015-08-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: I made a different fix for avoid the error posted when running. Sanad, PLEASE test running a file with astral char, the same way you did before, to see is there are any other problems. I cannot get such a file into an Idle editor on Windows. I *think* this

[issue24805] Python installer having problem in installing Python for all users in Windows

2015-08-05 Thread Debarshi Goswami
New submission from Debarshi Goswami: Python installer (msi) having problem in installing Python for all users in Windows. It gets installed for installing user only. I was able to log the python output and found the below in the log. MSI (s) (8C:D0) [07:13:00:212]: Determined that existing

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Ben Finney
Terry Reedy tjre...@udel.edu writes: Private answers are welcome. They will be deleted as soon as they are tallied (without names). Are you also expecting questionnaire answers in this forum? I suspect it will become a free-ranging discussion; hopefully you're prepared to pick through and

[issue24801] right-mouse click in IDLE on Mac doesn't work

2015-08-05 Thread Mark Roseman
Changes by Mark Roseman m...@markroseman.com: -- components: +IDLE ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24801 ___ ___ Python-bugs-list

[issue24787] csv.Sniffer guesses M instead of \t or , as the delimiter

2015-08-05 Thread Tiago Wright
Tiago Wright added the comment: I've run the Sniffer against 1614 csv files on my computer and compared the delimiter it detects to what I have set manually. Here are the results: SnifferHuman,;\t\(blank)Error:)ceMpGrand TotalError rate,498 2 110 1 5122.7%; 1 10.0%\t3

[issue24802] PyFloat_FromString Buffer Over-read

2015-08-05 Thread John Leitch
John Leitch added the comment: Attaching repro -- Added file: http://bugs.python.org/file40133/PyFloat_FromString_Buffer_Over-read.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24802 ___

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 11:06 AM, Terry Reedy tjre...@udel.edu wrote: There have been discussions, such as today on Idle-sig , about who uses Idle and who we should design it for. If you use Idle in any way, or know of or teach classes using Idle, please answer as many of the questions below as

Re: QUEST: does HACKING make FOR loop quicker.

2015-08-05 Thread Mark Lawrence
On 06/08/2015 01:29, Michael Torrie wrote: On 08/05/2015 03:39 PM, Mark Lawrence wrote: On 05/08/2015 21:00, John Doe wrote: Three strikes and you're out, good bye troll. While the original post is incomprehensible to me, I see only one post. What were the other two strikes? Same

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Rustom Mody
On Thursday, August 6, 2015 at 2:31:52 AM UTC+5:30, Tim Chase wrote: On 2015-08-05 06:37, Rustom Mody wrote: config = {} with open('config.ini') as f: for row in f: row = row.strip() if not row or row.startswith(('#', ';')): continue k, _, v

Re: How to trace the recursive path?

2015-08-05 Thread Terry Reedy
trace --trackcalls Display the calling relationships exposed by running the program. will give you part of what you want, but only counts. I would just add print('xyx calledl') at the top of each function you want traced. -- Terry Jan Reedy --

Re: Who uses IDLE -- please answer if you ever do, know, or teach

2015-08-05 Thread Rustom Mody
On Thursday, August 6, 2015 at 6:36:56 AM UTC+5:30, Terry Reedy wrote: There have been discussions, such as today on Idle-sig , about who uses Idle and who we should design it for. If you use Idle in any way, or know of or teach classes using Idle, please answer as many of the questions

[issue24667] OrderedDict.popitem()/__str__() raises KeyError

2015-08-05 Thread Eric Snow
Eric Snow added the comment: If I don't get any feedback before then, I'll commit the patch on Friday. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24667 ___

[issue24667] OrderedDict.popitem()/__str__() raises KeyError

2015-08-05 Thread Eric Snow
Eric Snow added the comment: @Fabian, hey, thanks for bringing it to our attention! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24667 ___ ___

Re: Linux script to get most expensive processes

2015-08-05 Thread Laura Creighton
If you are running this script with Python 2 write: if sys.platform.startswith('linux'): to handle the case where you get linux or linux2 (and a few other weird things some embedded systems give you ...) Right now I think every linux system returns linux for Python 3, so it is less of an

[issue24802] PyFloat_FromString Buffer Over-read

2015-08-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- type: behavior - crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24802 ___ ___

[issue24803] PyNumber_Long Buffer Over-read.patch

2015-08-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- versions: +Python 2.7, Python 3.4, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24803 ___

[issue24802] PyFloat_FromString Buffer Over-read

2015-08-05 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka components: +Interpreter Core nosy: +serhiy.storchaka stage: - patch review type: security - behavior versions: +Python 2.7, Python 3.4, Python 3.6 ___ Python tracker

Re: GOTCHA with list comprehension

2015-08-05 Thread Laura Creighton
In a message of Wed, 05 Aug 2015 17:05:49 +1000, Chris Angelico writes: Incidentally, why Python 2.6? Python 2.7 has been out for a pretty long time now, and if you can't move to version 3.x, I would at least recommend using 2.7. Since the release of 2.6.9 back before Frozen came out, that branch

[issue24805] Python installer having problem in installing Python for all users in Windows

2015-08-05 Thread Zachary Ware
Zachary Ware added the comment: The default for the 3.4 installer is to install for all users, so it's strange that you can't get it to install for all users. The log message you quote suggests that there's already a Python 3.4 installed per-user, is that the case? What results do you get

[issue23672] IDLE can crash if file name contains non-BMP Unicode characters

2015-08-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset dda625798111 by Terry Jan Reedy in branch '3.4': Issue #23672: Allow Idle to edit and run files with astral chars in name. https://hg.python.org/cpython/rev/dda625798111 New changeset 97d50e6247e1 by Terry Jan Reedy in branch '3.5': Issue

Re: Installation Successful, but pythonw and idle doesn't function

2015-08-05 Thread Terry Reedy
On 8/5/2015 12:12 PM, Rick Smith wrote: I was able to install various versions of Python (3.5.0b4 32bit being the most recent) multiple times (uninstalling in between) and they worked (python --version at the command line worked). However pythonw.exe did not and does not work. I was simply

[issue24801] right-mouse click in IDLE on Mac doesn't work

2015-08-05 Thread Mark Roseman
New submission from Mark Roseman: For popup menus, control-click works, but right-click on mouse buttons that support it, doesn't work. This is a followup to #10404, last addressed in 2010. As noted there, right click behaviour should be supported. The right click Tk text bindings on Mac

[issue18082] Inconsistent behavior of IOBase methods on closed files

2015-08-05 Thread Martin Panter
Martin Panter added the comment: The documentation https://docs.python.org/dev/library/io.html#io.IOBase says “. . . calling any method (even inquiries) on a closed stream is undefined. Implementations may raise ValueError”. So IMO you shouldn’t rely on any particular success or failure

[issue24803] PyNumber_Long Buffer Over-read.patch

2015-08-05 Thread John Leitch
New submission from John Leitch: Python suffers from a buffer over-read in PyNumber_Long() that is caused by the incorrect assumption that buffers returned by PyObject_GetBuffer() are null-terminated. This could potentially result in the disclosure of adjacent memory. PyObject *

Re: Uninstall

2015-08-05 Thread Laura Creighton
In a message of Tue, 04 Aug 2015 11:37:47 +0900, Bill writes: How do I uninstall Python from a Mac? -- https://mail.python.org/mailman/listinfo/python-list How did you get it in the first place? If you installed it yourself, then you have to retrace what steps you took to install it in order

Re: GOTCHA with list comprehension

2015-08-05 Thread Chris Angelico
On Thu, Aug 6, 2015 at 2:39 PM, Laura Creighton l...@openend.se wrote: In a message of Wed, 05 Aug 2015 17:05:49 +1000, Chris Angelico writes: Incidentally, why Python 2.6? Python 2.7 has been out for a pretty long time now, and if you can't move to version 3.x, I would at least recommend using

[issue24795] Make event loops with statement context managers

2015-08-05 Thread STINNER Victor
STINNER Victor added the comment: +1 for me. Asyncio examples already have this try/finally pattern. I already proposed to support context manager some months ago. Guido, I don't understand your point. Usually the main function id loop.run_until_complete/.run_forever. That's all. It doesn't

Re: Most Pythonic way to store (small) configuration

2015-08-05 Thread Tim Chase
On 2015-08-06 00:47, Marko Rauhamaa wrote: There's a certain simplicity to simply having key/value pairs separated by an = and then letting the application do whatever it needs/wants with those key/value strings. That trap has lured in a lot of wildlife. What to do with lists? Is

Re: Installation Successful, but pythonw and idle doesn't function

2015-08-05 Thread Thomas 'PointedEars' Lahn
Thomas 'PointedEars' Lahn wrote: http://stackoverflow.com/questions/9705982/pythonw-exe-or-python-exe (First hit for “pythonw” on Google with my account. I have never visited that site before or can remember to have searched for “pythonw”.) JFTR: s/site/question/. I am rather active on

Re: Uninstall

2015-08-05 Thread Emile van Sebille
On 8/4/2015 6:51 PM, Mario Figueiredo wrote: On Tue, Aug 4, 2015 at 9:01 PM, Mark Lawrence breamore...@yahoo.co.uk snip The simple solution is not to subscribe. Yes -- it's about gotten to that point. Or even better, tell you to fuck off. Now that's a first to my recollection. I must

[issue22329] Windows installer can't recover partially installed state

2015-08-05 Thread Steve Dower
Steve Dower added the comment: Thanks. Unfortunately I can't get anything helpful from that log because it's failing too early. It seems like you have some corruption in your Windows installer database, since it isn't even getting far enough into the Python installer. I'd track down a

[issue24782] Merge 'configure extensions' into main IDLE config dialog

2015-08-05 Thread Terry J. Reedy
Terry J. Reedy added the comment: I presume sorting the list is a trivial matter. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24782 ___ ___

[issue24792] zipimporter masks import errors

2015-08-05 Thread Amund Hov
New submission from Amund Hov: Due to mixed version .pyc files in my zipped python application I was getting inconsistent loading of certain packages. E.g. n [4]: zf.find_module('kitconsole') Out[4]: zipimporter object test_controller_test.zip In [5]: zf.load_module('kitconsole')

[issue24792] zipimporter masks import errors

2015-08-05 Thread Amund Hov
Changes by Amund Hov amund@gmail.com: -- type: behavior - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24792 ___ ___

[issue24793] Calling 'python' via subprocess.call ignoring passed %PATH%

2015-08-05 Thread Gregor
New submission from Gregor: I just noticed that there is a litte inconvenience when I try to invoke 'python' via subprocess.call passing an environment (%PATH%) from a script. I pass an environment where %PATH% only contains one directory where a python2.7.3-exe is present (I checked with

[issue24794] PyZipFile mixes compiled files from different python versions.

2015-08-05 Thread Amund Hov
New submission from Amund Hov: In my project I have a mixture of scripts using Python 2.7 and 3.4. Some of the scripts using python 3.4 are packaged into archives using PyZipFile. Through some combination I ended up with 2.7 compiled packages in my archive when packaging using python 3.4. In

[issue2292] Missing *-unpacking generalizations

2015-08-05 Thread Guido van Rossum
Guido van Rossum added the comment: Yes we should. I'd consider it a bug if it wasn't supported in 3.5.0 and we could fix that bug in 3.5.1. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2292

[issue24272] PEP 484 docs

2015-08-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset a8dcbd2711d6 by Guido van Rossum in branch '3.5': Issue #24272: Initial docs for typing.py (PEP 484). https://hg.python.org/cpython/rev/a8dcbd2711d6 New changeset 0c74fd4219aa by Guido van Rossum in branch 'default': Issue #24272: Initial docs for

[issue23973] PEP 484 implementation

2015-08-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset f142b7c7a8e3 by Guido van Rossum in branch '3.5': Issue #23973: Update typing.py from GitHub repo. https://hg.python.org/cpython/rev/f142b7c7a8e3 New changeset c9a6ce666ff2 by Guido van Rossum in branch 'default': Issue #23973: Update typing.py

  1   2   >