Re:If statement issue driving me nuts

2014-04-06 Thread Dave Angel
Anthony Smith jackie.walkab...@gmail.com Wrote in message: Hi I have a small project and I have been unable to get the following statement to work. Any help would great. User inputs can either self_sale_head which is a $ value,if a $ value is not add a self.estimated_weight_hd is used to

Re: How can I parse this correctly?

2014-04-06 Thread Anthony Papillion
On Apr 5, 2014, at 23:03, Chris Angelico ros...@gmail.com wrote: On Sun, Apr 6, 2014 at 1:52 PM, Anthony Papillion papill...@gmail.com wrote: When I try to cast them like this: print int(row['YEAR']) I am told by the interpreter: Traceback (most recent call last): File analyze.py, line

Re: If statement issue driving me nuts

2014-04-06 Thread Gary Herron
On 04/05/2014 09:58 PM, Anthony Smith wrote: Hi I have a small project and I have been unable to get the following statement to work. Any help would great. User inputs can either self_sale_head which is a $ value,if a $ value is not add a self.estimated_weight_hd is used to get the total

Re: How can I parse this correctly?

2014-04-06 Thread Anthony Papillion
On Apr 5, 2014, at 23:21, Ben Finney ben+pyt...@benfinney.id.au wrote: Anthony Papillion papill...@gmail.com writes: for row in r: print row['YEAR'] This works fine. But, I am needing to do date addition/subtraction using datetime and so I need these dates as integers. I assume you mean

Mutable objects inside tuples - good or bad?

2014-04-06 Thread John Ladasky
I find this programming pattern to be useful... but can it cause problems? Python 3.3.2+ (default, Feb 28 2014, 00:52:16) [GCC 4.8.1] on linux Type help, copyright, credits or license for more information. a = [1,2,3] b = [4,5,6] c = (a,b) c ([1, 2, 3], [4, 5, 6]) c[0][0] = 0 c ([0, 2, 3],

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Gary Herron
On 04/05/2014 11:53 PM, John Ladasky wrote: I find this programming pattern to be useful... but can it cause problems? No. What kind of problems are you considering? It won't break Python. It's perfectly legal code. The tuple c is still immutable, consisting of two specific objects, and

Keeping track of things with dictionaries

2014-04-06 Thread Giuliano Bertoletti
I frequently use this pattern to keep track of incoming data (for example, to sum up sales of a specific brand): = # read a brand record from a db ... # keep track of brands seen obj = brands_seen.get(brandname) if obj is None: obj = Brand()

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Devin Jeanpierre
On Sun, Apr 6, 2014 at 12:25 AM, Gary Herron gary.her...@islandtraining.com wrote: On 04/05/2014 11:53 PM, John Ladasky wrote: I find this programming pattern to be useful... but can it cause problems? No. What kind of problems are you considering? It won't break Python. It's perfectly

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Mark H Harris
On 4/4/14 4:53 AM, Steven D'Aprano wrote: Python is not a computer-science-ey language. Every programming language is interesting from a comp sci standpoint. Some are more useful for research; python is one of those. For what reasons do you disagree? marcus --

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Mark H Harris
On 4/4/14 4:53 AM, Steven D'Aprano wrote: Python is not a computer-science-ey language. Really ? It is of little or no interest to computer scientists involved in the mathematics of computation, ... you mean no one except me, then ? or compiler-theory, or type-theory, or any of

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Mark H Harris
On 4/4/14 4:53 AM, Steven D'Aprano wrote: Python is not a computer-science-ey language. Really ? It is of little or no interest to computer scientists involved in the mathematics of computation, ... you mean no one except me, then ? or compiler-theory, or type-theory, or any of

A data conversion question

2014-04-06 Thread Mok-Kong Shen
A newbie's question of curiosity: If I have g=[1,[2]] and bg=bytearray(str(g),latin-1) could I somehow get back from bg a list g1 that is the same as g? Thanks in advance. M. K. Shen -- https://mail.python.org/mailman/listinfo/python-list

Re: How can I parse this correctly?

2014-04-06 Thread Chris Angelico
On Sun, Apr 6, 2014 at 4:29 PM, Anthony Papillion papill...@gmail.com wrote: No particular reason at all. I've Bern dabbling in Python for the last bit and am just writing code based on the samples or examples I'm finding. What was the tipoff that this was not Python 3? Would there be a large

Re: How can I parse this correctly?

2014-04-06 Thread Ben Finney
Anthony Papillion papill...@gmail.com writes: On Apr 5, 2014, at 23:21, Ben Finney ben+pyt...@benfinney.id.au wrote: Alternatively, if you just want to do integer arithmetic on the year, you don't need the ‘datetime’ module at all. True. But I do actually need to some date based

Re: Keeping track of things with dictionaries

2014-04-06 Thread Peter Otten
Giuliano Bertoletti wrote: I frequently use this pattern to keep track of incoming data (for example, to sum up sales of a specific brand): = # read a brand record from a db ... # keep track of brands seen obj = brands_seen.get(brandname) if obj

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Chris Angelico
On Sun, Apr 6, 2014 at 5:55 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Sun, Apr 6, 2014 at 12:25 AM, Gary Herron gary.her...@islandtraining.com wrote: On 04/05/2014 11:53 PM, John Ladasky wrote: I find this programming pattern to be useful... but can it cause problems? No. What

Re: How can I parse this correctly?

2014-04-06 Thread Chris Angelico
On Sun, Apr 6, 2014 at 6:16 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: print int(row['YEAR'] or ) “foo or bar” is not a Pythonic way to get a default value; it relies on quirks of implementation and is not expressive as to the meaning you intend. Rather, be explicit: #

Re: A data conversion question

2014-04-06 Thread Peter Otten
Mok-Kong Shen wrote: A newbie's question of curiosity: If I have g=[1,[2]] and bg=bytearray(str(g),latin-1) could I somehow get back from bg a list g1 that is the same as g? Not for arbitrary values, but for lists, ints, and a few other types that's not a problem: g = [1, [2]]

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Marko Rauhamaa
Mark H Harris harrismh...@gmail.com: On 4/4/14 4:53 AM, Steven D'Aprano wrote: Python is not a computer-science-ey language. Every programming language is interesting from a comp sci standpoint. Some are more useful for research; python is one of those. For what reasons do you disagree?

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Devin Jeanpierre
On Sun, Apr 6, 2014 at 1:25 AM, Chris Angelico ros...@gmail.com wrote: On Sun, Apr 6, 2014 at 5:55 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote: Agreed. Putting mutable objects inside tuples is common and totally OK. There are many programming habits that can cause problems, even though

Re: How can I parse this correctly?

2014-04-06 Thread Mark Lawrence
On 06/04/2014 09:17, Chris Angelico wrote: On Sun, Apr 6, 2014 at 4:29 PM, Anthony Papillion papill...@gmail.com wrote: No particular reason at all. I've Bern dabbling in Python for the last bit and am just writing code based on the samples or examples I'm finding. What was the tipoff that

Re: Python streaming media server

2014-04-06 Thread Mark Lawrence
On 06/04/2014 05:31, Wesley wrote: 在 2014年4月5日星期六UTC+8下午6时11分02秒,Wesley写道: Hi, Anyone knows open source streaming media server written by Python? I am trying to setup a streaming media server in python, wanna find an existing one and have a look. Thanks. Wesley After a lot google

Re: How can I parse this correctly?

2014-04-06 Thread Chris Angelico
On Sun, Apr 6, 2014 at 9:32 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: I'd recommend using this import statement in Python 2 so you get used to print being a function. from __future__ import print_function Or better still, just write Python 3 code - then you get to take advantage of all

Re: How can I parse this correctly?

2014-04-06 Thread Mark Lawrence
On 06/04/2014 12:54, Chris Angelico wrote: On Sun, Apr 6, 2014 at 9:32 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: I'd recommend using this import statement in Python 2 so you get used to print being a function. from __future__ import print_function Or better still, just write Python 3

Re: Python streaming media server

2014-04-06 Thread Sturla Molden
Wesley nisp...@gmail.com wrote: Not open source, but there is a famous closed-source one called YouTube. Are you kidding? I know youtube, but do you think we can use it setup our own streaming media server? Obviously not. Before YouTube was bought by Google, it was common knowledge that

Re: How can I parse this correctly?

2014-04-06 Thread Tim Chase
On 2014-04-06 14:21, Ben Finney wrote: I assume you mean you will be creating ‘datetime.date’ objects. What will you set as the month and day? Alternatively, if you just want to do integer arithmetic on the year, you don't need the ‘datetime’ module at all. Even if you do the arithmetic by

Re: Mutable objects inside tuples - good or bad?

2014-04-06 Thread Rustom Mody
On Sunday, April 6, 2014 1:40:58 PM UTC+5:45, Devin Jeanpierre wrote: You can choose to define mutability that way, but in many contexts you'll find that definition not very useful. c is such that you could have another variable d, where the following interpreter session fragment is easily

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Steven D'Aprano
On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Mark H Harris harrismh...@gmail.com: On 4/4/14 4:53 AM, Steven D'Aprano wrote: Python is not a computer-science-ey language. Every programming language is interesting from a comp sci standpoint. Some are more useful for research;

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 2:52 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: (4) This is the category which I was referring to when I said that Python wasn't a computer-science-ey language: do people use Python for research into language-independent fundamental principles of

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Rustom Mody
On Sunday, April 6, 2014 10:22:21 PM UTC+5:30, Steven D'Aprano wrote: On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Mark H Harris : On 4/4/14 4:53 AM, Steven D'Aprano wrote: Python is not a computer-science-ey language. Every programming language is interesting from a comp

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Marco S.
On 3 April 2014 20:12, Ian Kelly ian.g.kelly-at-gmail.com | python-list@python.org| dnl5yyr...@sneakemail.com wrote: Use this instead [of continue]: switch day case in (Mon, Tue, Wed, Thu, Fri): go_to_work = True day_type = ferial if day in (Tue, Thu): lunch_time =

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 3:31 AM, Rustom Mody rustompm...@gmail.com wrote: However consider that some of the things that people did around 40 years ago and do today - use FORTRAN for numerical/simulation work -- now use scipy/sage etc - NLP with Lisp/Prolog -- look at Nltk - ??? with Data

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Mark Lawrence
On 06/04/2014 18:27, Chris Angelico wrote: (plus, why on earth can't they afford a few more forks in the interests of hygiene??!?). They couldn't get the purchase order for these capital cost items past the accountants. -- My fellow Pythonistas, ask not what our language can do for you, ask

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 3:49 AM, Marco S. elbar...@gmail.com wrote: switch day case in briefing_days: lunch_time = datetime.time(11, 30) meeting_time = datetime.time(12, 30) case not in briefing_days + festive_days: lunch_time = datetime.time(12) meeting_time =

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 4:09 AM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 06/04/2014 18:27, Chris Angelico wrote: (plus, why on earth can't they afford a few more forks in the interests of hygiene??!?). They couldn't get the purchase order for these capital cost items past the

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Rustom Mody
On Sunday, April 6, 2014 11:24:15 PM UTC+5:30, Chris Angelico wrote: On Mon, Apr 7, 2014 at 3:31 AM, Rustom Mody wrote: However consider that some of the things that people did around 40 years ago and do today - use FORTRAN for numerical/simulation work -- now use scipy/sage etc - NLP

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 4:13 AM, Rustom Mody rustompm...@gmail.com wrote: Is the diff between cvs/svn and git just one vcs or another? The theory of version control, or source control, or whatever you want to call it, can be found in some of the docs for those systems (git goes into some depth

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Michael Torrie
On 04/06/2014 12:07 PM, Chris Angelico wrote: This has a slight oddity of parsing (in that an expression can normally have a comparison in it); if you really want to use the result of a comparison inside a case block, you'd have to parenthesize it. But it's easy enough to explain to a human.

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Marko Rauhamaa
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Python, BTW, is perfectly suitable for computer science. I don't think it is. Python is not a pure functional language, so it's very difficult to prove anything about the code

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Marko Rauhamaa
Chris Angelico ros...@gmail.com: * unfaithful husbands on an island ruled by female logicians I don't know that one. Me neither, although I can see elements of classic logic analysis elements. Islands ruled by logicians, people who always tell the truth / always tell exact falsehoods,

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Ian Kelly
On Sun, Apr 6, 2014 at 11:49 AM, Lucas Malor 3kywjyd...@snkmail.com wrote: On 3 April 2014 20:12, Ian Kelly ian.g.kelly-at-gmail.com |python-list@python.org| dnl5yyr...@sneakemail.com wrote: Use this instead [of continue]: switch day case in (Mon, Tue, Wed, Thu, Fri): go_to_work = True

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Mark Lawrence
On 06/04/2014 21:10, Marko Rauhamaa wrote: Many classic CS ideas are expressed in terms of an Algol-like language. Nothing would prevent you from framing those ideas in a Python-like (pseudo)language. The question is mostly whether you prefer begin/end, braces or indentation. Of course

Re: Yet Another Switch-Case Syntax Proposal

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 6:13 AM, Michael Torrie torr...@gmail.com wrote: On 04/06/2014 12:07 PM, Chris Angelico wrote: This has a slight oddity of parsing (in that an expression can normally have a comparison in it); if you really want to use the result of a comparison inside a case block,

[ANN] ClamAV for Python 0.2!

2014-04-06 Thread Ryan Gonzalez
Announcing ClamAV for Python 0.2! ClamAV for Python is a set of pure-Python bindings for libclamav. This version adds basic support for callbacks and makes it work under Python 3. Check it out of PyPIhttps://pypi.python.org/pypi/clamavand GitHub https://github.com/kirbyfan64/clamav-python. Report

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Steven D'Aprano
On Sun, 06 Apr 2014 23:10:47 +0300, Marko Rauhamaa wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Python, BTW, is perfectly suitable for computer science. I don't think it is. Python is not a pure functional language,

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Terry Reedy
On 4/6/2014 7:48 PM, Steven D'Aprano wrote: On Sun, 06 Apr 2014 23:10:47 +0300, Marko Rauhamaa wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Python, BTW, is perfectly suitable for computer science. I don't think it

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Rustom Mody
On Monday, April 7, 2014 6:15:47 AM UTC+5:30, Terry Reedy wrote: On 4/6/2014 7:48 PM, Steven D'Aprano wrote: On Sun, 06 Apr 2014 23:10:47 +0300, Marko Rauhamaa wrote: Steven D'Aprano : On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Python, BTW, is perfectly suitable for

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Rustom Mody
On Monday, April 7, 2014 12:16:54 AM UTC+5:30, Chris Angelico wrote: On Mon, Apr 7, 2014 at 4:13 AM, Rustom Mody wrote: Using Python at the design stage would be what Steven's talking about - actually using it to build the theory of programming. I have about as much experience in the area

threading

2014-04-06 Thread Onder Hazaroglu
Hello, I've been using threading library to run some experiments parallel. There is no message passing between my threads but still it messes up somehow. The results are different than running it separated. Basically I experiment with three threads working on three different files but the results

Re: threading

2014-04-06 Thread Ben Finney
Onder Hazaroglu oxhazaro...@ualr.edu writes: I've been using threading library to run some experiments parallel. Threading is very difficult to get right, much more so than the usual separation into distinct processes. How did you decide against the normal means of parallel execution and

Re: threading

2014-04-06 Thread Rustom Mody
On Monday, April 7, 2014 8:24:37 AM UTC+5:30, Onder Hazaroglu wrote: Hello, I've been using threading library to run some experiments parallel. There is no message passing between my threads but still it messes up somehow. The results are different than running it separated. Basically I

Re: Python streaming media server

2014-04-06 Thread Wesley
在 2014年4月6日星期日UTC+8下午8时52分37秒,Sturla Molden写道: Wesley nisp...@gmail.com wrote: Not open source, but there is a famous closed-source one called YouTube. Are you kidding? I know youtube, but do you think we can use it setup our own streaming media server? Obviously

Re: threading

2014-04-06 Thread Roy Smith
In article mailman.8969.1396839923.18130.python-l...@python.org, Ben Finney ben+pyt...@benfinney.id.au wrote: The *whole point* of threading (AFAIK) is to share memory and other process-distinct resources. There is (or at least, was) another reason. Creating a new process used to be far

Re: threading

2014-04-06 Thread Chris Angelico
On Mon, Apr 7, 2014 at 1:48 PM, Roy Smith r...@panix.com wrote: There is (or at least, was) another reason. Creating a new process used to be far more expensive than creating a new thread. In modern Unix kernels, however, the cost difference has become much less, so this is no longer a

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Marko Rauhamaa
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Sun, 06 Apr 2014 23:10:47 +0300, Marko Rauhamaa wrote: It is academic because the author, Raymond Smullyan, was a professor of philosophy and, more importantly, my professor selected that as a textbook for us graduate students. Ah.

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Steven D'Aprano
On Sun, 06 Apr 2014 20:45:47 -0400, Terry Reedy wrote: On 4/6/2014 7:48 PM, Steven D'Aprano wrote: On Sun, 06 Apr 2014 23:10:47 +0300, Marko Rauhamaa wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: On Sun, 06 Apr 2014 12:05:16 +0300, Marko Rauhamaa wrote: Python, BTW, is

Re: threading

2014-04-06 Thread Marko Rauhamaa
Ben Finney ben+pyt...@benfinney.id.au: The *whole point* of threading (AFAIK) is to share memory and other process-distinct resources. Another way to look at it is that threads were pushed as a magic bullet to manage the complexities of network programming. They were fashionable in Windows and

Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list)

2014-04-06 Thread Marko Rauhamaa
Steven D'Aprano st...@pearwood.info: That's why optimizers like PyPy generally produce code like this: if some guard condition is true: run fast optimized branch else: fall back on standard Python There you go! You are using Python-esque syntax to communicate a CS

Re: threading

2014-04-06 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: On Mon, Apr 7, 2014 at 1:48 PM, Roy Smith r...@panix.com wrote: There is (or at least, was) another reason. Creating a new process used to be far more expensive than creating a new thread. In modern Unix kernels, however, the cost difference has

Re: threading

2014-04-06 Thread Paul Rubin
Marko Rauhamaa ma...@pacujo.net writes: Since then both Windows and Java have come up with their own I/O multiplexing facilities. Now we see Python follow suit with asyncio. That all happened because threads in those systems are rather expensive. GHC and Erlang have fast lightweight

Re: threading

2014-04-06 Thread Marko Rauhamaa
Paul Rubin no.email@nospam.invalid: I keep hearing about all the perils of threading bugs and it just hasn't happened to me in Python as far as I know. Good for you. I'm saying the first step to thread-safe code is to have a healthy fear of the perils. The main trick is to not share any

[issue21130] equivalent functools.partial instances should compare equal

2014-04-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: I guess a partial is a binding, not a function. Viewed in that light, it makes sense to implement same logic as used for bound methods in method_richcompare. -- keywords: +easy stage: test needed - needs patch

[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-06 Thread Hristo Venev
Hristo Venev added the comment: I will not add PyLong_AsUnsigned*AndOverflow in my code because I don't want my code to depend on the exact implementation of PyLong. Are you seriously calling a 50-line function feature? Anyway... I propose splitting the patch in two parts: - cleanup: the

[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-06 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the patch! I left a couple of comments on Rietveld. The patch will also need docs and tests before it's ready to go in. There's a behaviour change in the patch which needs looking into: before the patch, PyLong_AsUnsignedLong will not call the

[issue21144] ensurepip AssertionError: Multiple .dist-info directories

2014-04-06 Thread Samuel John
Changes by Samuel John pyt...@samueljohn.de: -- nosy: +samueljohn ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21144 ___ ___ Python-bugs-list

[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-04-06 Thread Nick Coghlan
Nick Coghlan added the comment: No, the attribute level arguments won't go away - __name__ deliberately differs from __spec__.name in some cases (notably in __main__), __path__ may be manipulated after the module is loaded, and __name and __file__ are both used too heavily within module code

[issue21145] Add the @cached_property decorator

2014-04-06 Thread Omer Katz
Omer Katz added the comment: The default implementation should simple: Once the property is accessed for the first time calculate the result and never calculate again. It's what both Django pip uses. You can add an optional TTL. There aren't any other features I can come up with that are common

[issue21145] Add the @cached_property decorator

2014-04-06 Thread Omer Katz
Omer Katz added the comment: I just checked and werkzeug uses the same implementation as Django pip. 2014-04-06 14:31 GMT+04:00 Omer Katz rep...@bugs.python.org: Omer Katz added the comment: The default implementation should simple: Once the property is accessed for the first time

[issue20397] distutils --record option does not validate existance of byte-compiled files

2014-04-06 Thread koobs
Changes by koobs koobs.free...@gmail.com: -- nosy: +koobs ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20397 ___ ___ Python-bugs-list mailing

[issue21109] tarfile: Traversal attack vulnerability

2014-04-06 Thread Lars Gustäbel
Lars Gustäbel added the comment: In the past, our answer to these kinds of bug reports has always been that you must not extract an archive from an untrusted source without making sure that it has no malicious contents. And that tarfile conforms to the posix specifications with respect to

[issue15955] gzip, bz2, lzma: add option to limit output size

2014-04-06 Thread Nadeem Vawda
Nadeem Vawda added the comment: I've posted a review at http://bugs.python.org/review/15955/. (For some reason, it looks like Rietveld didn't send out email notifications. But maybe it never sends a notification to the sender? Hmm.) -- ___ Python

[issue21109] tarfile: Traversal attack vulnerability

2014-04-06 Thread Larry Hastings
Larry Hastings added the comment: Thank you Lars for your thorough reply. While I agree that this isn't a release blocker, as it was clearly designed to behave this way... it seems to me that it wouldn't take much to make the tarfile module a lot safer. Specifically: * Don't allow

[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-06 Thread Hristo Venev
Hristo Venev added the comment: I did not intend to make it so that PyLong_AsUnsignedLong* to call __int__ but it looks like a good idea because PyLong_AsLong* does that and the patch is exactly about that - removing differences between converting to signed and unsigned. Should I upload the

[issue21111] PyLong_AsUnsignedLongAndOverflow does not exist

2014-04-06 Thread Mark Dickinson
Mark Dickinson added the comment: it looks like a good idea It's not a good idea, though: you risk breaking existing third-party extension modules in surprising ways, which isn't a friendly thing to do. In any case, if anything the PyLong methods should be moving *away* from use of the

[issue21139] Idle: change default reformat width from 70 to 72

2014-04-06 Thread Saimadhav Heblikar
Changes by Saimadhav Heblikar saimadhavhebli...@gmail.com: -- nosy: +sahutd ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21139 ___ ___

[issue15955] gzip, bz2, lzma: add option to limit output size

2014-04-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, Rietveld never sends a notification to the sender. I've received a notification. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15955 ___

[issue21145] Add the @cached_property decorator

2014-04-06 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21145 ___ ___

[issue20383] Add a keyword-only spec argument to types.ModuleType

2014-04-06 Thread Brett Cannon
Brett Cannon added the comment: I can dream about getting rid of the attributes, but I doubt it would happen any time soon, if at all. But we do need to make it easier to set __spec__ on a new module than it currently is to help promote its use. --

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: I would guess that the problem is simply that LogisticRegression objects are not picklable. Does the problem still occur if you do not use freeze? -- ___ Python tracker rep...@bugs.python.org

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Ivan K
Ivan K added the comment: Sorry, I'm not sure I describe it correct. Freeze that means = goes fozen, so stop progress. It's do no do anything, but computations still load single core of my cpu for 100% untill I do not kill the python process. But the same code work's fine if executed outside

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: Ah, I misunderstood: you meant that it freezes/hangs, not that you used a freeze tool. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21162 ___

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Ivan K
Ivan K added the comment: Yes, I'm not using any tool. Code just not working. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21162 ___ ___

[issue20998] fullmatch isn't matching correctly under re.IGNORECASE

2014-04-06 Thread Gareth Gouldstone
Gareth Gouldstone added the comment: fullmatch() is not yet implemented on the regex scanner object SRE_Scanner (issue 21002). Is it possible to adapt this patch to fix this omission? -- nosy: +Gareth.Gouldstone ___ Python tracker

[issue1191964] asynchronous Subprocess

2014-04-06 Thread Josiah Carlson
Josiah Carlson added the comment: Should have uploaded this yesterday, but I got caught up with typical weekend activities. The docs probably need more, and I hear that select.select() is disliked, so that will probably need to be changed too. -- Added file:

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Richard Oudkerk
Richard Oudkerk added the comment: Could you try pickling and unpickling the result of func(): import cPickle data = cPickle.dumps(func([1,2,3]), -1) print cPickle.loads(data) -- ___ Python tracker rep...@bugs.python.org

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Ivan K
Ivan K added the comment: Sorry, could you specify what is 'func' ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21162 ___ ___

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Ivan K
Ivan K added the comment: Sorry, stupdi question. Forget that this is from my gist -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21162 ___ ___

[issue21162] code in multiprocessing.pool freeze if inside some code from scikit-learn (and probably liblinear) executed on ubuntu 12.04 64 Bit

2014-04-06 Thread Ivan K
Ivan K added the comment: Yes, it work fine and output was LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, penalty=l2, random_state=None, tol=0.0001) -- ___ Python tracker

[issue12014] str.format parses replacement field incorrectly

2014-04-06 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12014 ___

[issue21118] str.translate is absurdly slow in majority of use cases (takes up to 60x longer than similar functions)

2014-04-06 Thread Josh Rosenberg
Josh Rosenberg added the comment: Thanks for addressing this so fast. Annoyingly, I suspect it will not help the original case that led me to finding the slowdown (I had some code that was translating from 56 latin-1 Romance characters with diacritics to the equivalent ASCII characters, so it

[issue21119] asyncio create_connection resource warning

2014-04-06 Thread Lars Andersson
Lars Andersson added the comment: Thanks Victor, that fixes my problem. I've started using tulip/master as part of my project as that also solves other issues I have with the default asyncio of python 3.4.0, but hopefully this fix will into tulip/master as well as python 3.4.1 / 3.5.

[issue21164] print unicode in Windows console

2014-04-06 Thread Leslie Klein
New submission from Leslie Klein: The console behaves by encoding a str (using the sys.getdefaultencoding()) and then decodes the bytes to a glyph for rendering. The decoder used is 'cp437'. Apparently, there is no way to override that! See ipython notebook for summary and example of the