[issue28245] Embeddable Python does not use PYTHONPATH.

2016-09-21 Thread Jarno Rajala
New submission from Jarno Rajala: The Windows 64-bit embeddable Python 3.5.2 (also 3.5.1), downloadable from https://www.python.org/ftp/python/3.5.2/python-3.5.2-embed-amd64.zip, does not set sys.path according to PYTHONPATH. To reproduce this bug, run these commands from the directory with

Re: Cython taking more time than regular Python

2016-09-21 Thread Gregory Ewing
Lawrence D’Oliveiro wrote: Don’t forget “functino”. :) ... is that the gauge boson for the function field? Or is that a “functon”? One of them might be spin-½ ... A functino would be the supersymmetric partner of a bosonic function. For a fermionic function, its partner would be a sfunction.

Re: Pasting code into the cmdline interpreter

2016-09-21 Thread Ben Finney
Veek M writes: > 1. I had to turn on highlighting to catch mixed indent (which is a > good thing anyways so this was resolved - not sure how tabs got in > anyhow) The EditorConfig system is a growing consensus for configuring a code base to instruct text editors not to

Pasting code into the cmdline interpreter

2016-09-21 Thread Veek M
I wanted to test this piece of code which is Kate (editor) on the cmd line python >>> prompt: tex_matches = re.findall(r'(\\\w+{.+?})|(\\\w+)', msg) for tex_word in tex_matches: repl = unicode_tex.tex_to_unicode_map.get(tex_word) if repl is None: repl = 'err' msg =

[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-09-21 Thread Nick Coghlan
Nick Coghlan added the comment: George's initial patch that naively checks for signals on every iteration could be used to get an upper bound on the likely benchmark impact. I do think this is a case where we'll want a dedicated microbenchmark to complement the macrobenchmark suite, though -

[issue20173] Derby #4: Convert 53 sites to Argument Clinic across 5 files

2016-09-21 Thread Zachary Ware
Zachary Ware added the comment: This appears to be finished, please reopen if I'm mistaken. -- nosy: +zach.ware resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

Re: How to import all things defined the files in a module directory in __init__.py?

2016-09-21 Thread Ben Finney
Peng Yu writes: > I want to import all the thing (or the ones available in the > respective __all__) defined in each of the file by putting the > following lines in __init__.py > > from file1 import * > > from filen import * > > However, I don't want to hardcode the

Where is import defined in the source code? (python 2)

2016-09-21 Thread Peng Yu
Hi, I want know where import is defined in the source code. Is it implemented using __import__? -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list

Is there any currently-working 3rd party snapchat API for python?

2016-09-21 Thread hhkieu
Which one do you use? I want to build a snapchat bot that downloads video sent to my account, and uploads it to my story! -- https://mail.python.org/mailman/listinfo/python-list

How to import all things defined the files in a module directory in __init__.py?

2016-09-21 Thread Peng Yu
Hi, Suppose that I have file1.py, ..., filen.py in a module directory. I want to import all the thing (or the ones available in the respective __all__) defined in each of the file by putting the following lines in __init__.py from file1 import * from filen import * However, I don't want

Re: Data Types

2016-09-21 Thread Sayth Renshaw
> > > >> Are there any other data types that will give you type(A) or type(B) = > >> besides True and False? > > > > No types but any variable or expression containing True or False will be > > a bool type (or class bool): > > "Containing" True or False? Certainly not: > > py> type( [1, 2,

Re: strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
This ends being the code I can use to get it to work, seems clear and pythonic, open to opinion on that :-) answer = input("\t >> ") if isinstance(int(answer), int) is True: raise ValueError("Ints aren't valid input") sys.exit() elif isinstance(answer, str) is True: print(v0 * t

Re: Cython taking more time than regular Python

2016-09-21 Thread Lawrence D’Oliveiro
On Wednesday, September 21, 2016 at 6:05:07 PM UTC+12, Gregory Ewing wrote: > > Christian Gollwitzer wrote: > >> It may take a microsecond to call a functino from Python. > > Obviously the compiler used was a "dump" compiler. :-) Don’t forget “functino”. :) For some reason it awakens

Re: strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
To answer all the good replies. I adapted a simple vector example from the Springer book practical primer on science with python. Having solved the actual problem I thought checking with the user they had the correct entries or would like to ammend them would be a good addition. This leads to

Re: csjark module

2016-09-21 Thread bezenchu
On Thursday, September 22, 2016 at 5:51:43 AM UTC+3, beze...@gmail.com wrote: > On Wednesday, September 21, 2016 at 10:09:25 PM UTC+3, Peter Otten wrote: > > bezen...@gmail.com wrote: > > > > > On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > > >> bezen...@gmail.com

[issue28244] Incorrect Example in itertools.product description

2016-09-21 Thread Matthew Ekstrand-Abueg
New submission from Matthew Ekstrand-Abueg: Documentation states: # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 But: >>> list(itertools.product('ABCD','xy')) [('A', 'x'), ('A', 'y'), ('B', 'x'), ('B', 'y'), ('C',

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 10:09:25 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten > >> >

[issue28243] Performance regression in functools.partial()

2016-09-21 Thread Emanuel Barry
Changes by Emanuel Barry : -- nosy: +ebarry ___ Python tracker ___ ___ Python-bugs-list

Re: Data Types

2016-09-21 Thread Steve D'Aprano
On Wed, 21 Sep 2016 10:25 pm, BartC wrote: > On 21/09/2016 05:03, Cai Gengyang wrote: > >> Are there any other data types that will give you type(A) or type(B) = >> besides True and False? > > No types but any variable or expression containing True or False will be > a bool type (or class

[issue28234] In xml.etree.ElementTree docs there are many absent Element class links

2016-09-21 Thread Martin Panter
Martin Panter added the comment: Mostly looks good to me. I left some comments on the code review. -- nosy: +martin.panter versions: +Python 2.7, Python 3.5, Python 3.7 ___ Python tracker

Re: get the sum of differences between integers in a list

2016-09-21 Thread Steve D'Aprano
On Thu, 22 Sep 2016 01:51 am, marco.naw...@colosso.nl wrote: > And here is a straightforward one without any helpers: Please don't do people's homework for them. -- Steve “Cheer up,” they said, “things could be worse.” So I cheered up, and sure enough, things got worse. --

Re: automated comparison tool

2016-09-21 Thread Steve D'Aprano
On Thu, 22 Sep 2016 01:55 am, Andrew Clark wrote: > I reinstalled paramiko and now i'm getting a slighty different error but > still says no cryptography. [...] > ImportError: No module named 'cryptography' You appear to be missing a dependency of paramiko. You need to identify which

Re: strings and ints consistency - isinstance

2016-09-21 Thread Steve D'Aprano
On Thu, 22 Sep 2016 12:26 am, Sayth Renshaw wrote: > Hi > > Trying to clarify why ints and strings arent treated the same. Because ints and strings are different? :-) > You can get a valuerror from trying to cast a non-int to an int as in > int(3.0) however you cannot do a non string with

Re: automated comparison tool

2016-09-21 Thread Kalos Kalyre
On 2016-09-21 08:55, Andrew Clark wrote: > I reinstalled paramiko and now i'm getting a slighty different error but > still says no cryptography. > > Traceback (most recent call last): > File "C:\Users\ac40935\workspace\AutoCompare\filecmp.py", line 6, in > > from paramiko import

[issue28240] Enhance the timeit module: display average +- std dev instead of minimum

2016-09-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I'd suggest to display all values and base the findings on > all available values, rather than just one: > min, max, avg, median, stddev. If we're going to go down that path, I suggest using something like: https://en.wikipedia.org/wiki/Five-number_summary

Re: strings and ints consistency - isinstance

2016-09-21 Thread John Gordon
In Sayth Renshaw writes: > Trying to clarify why ints and strings arent treated the same. Because they are not the same. > You can get a valuerror from trying to cast a non-int to an int as in > int(3.0) however

[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-09-21 Thread Terry J. Reedy
Terry J. Reedy added the comment: The request is to check 'occasionally'. To me this means perhaps once a second, which is to say, ^c should generally interrupt within a second, and on average with half a second. The following takes just under a second: "sum(i for i in range(1000))"

[issue27400] Datetime NoneType after calling Py_Finalize and Py_Initialize

2016-09-21 Thread Jim Jewett
Jim Jewett added the comment: Having to (re-)fill the cache once per interpreter seems like a reasonable price to pay. Why is 3.5 not included? Did this not cause problems before the import change, or is it just that this bug is small enough that maybe it isn't worth backporting?

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread Oscar Benjamin
On 21 September 2016 at 21:28, Malcolm Greene wrote: > Looking for ideas on how I can obtain the raw line of text read by a > CSVDictReader. I've reviewed the CSV DictReader documentation and there > are no public attributes that expose this type of data. > > My use case is

Re: Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread MRAB
On 2016-09-21 21:28, Malcolm Greene wrote: Looking for ideas on how I can obtain the raw line of text read by a CSVDictReader. I've reviewed the CSV DictReader documentation and there are no public attributes that expose this type of data. My use case is reporting malformed lines detected when

[issue28228] imghdr does not support pathlib

2016-09-21 Thread Brett Cannon
Brett Cannon added the comment: "Removing the provisional status" of what? Pathlib? If so, have you asked Ned if adding support during the beta period is acceptable? This open question is probably why Serhiy changed the type as without Ned's sign-off it means changing something in the stdlib

Re: how to automate java application in window using python

2016-09-21 Thread Emile
On 09/18/2016 06:37 PM, Lawrence D’Oliveiro wrote: On Monday, September 19, 2016 at 11:32:25 AM UTC+12, Michael Torrie wrote: One I've used is AutoIt. Like I said, this kind of thing can never

Obtain the raw line of text read by CSVDictReader when reporting errors?

2016-09-21 Thread Malcolm Greene
Looking for ideas on how I can obtain the raw line of text read by a CSVDictReader. I've reviewed the CSV DictReader documentation and there are no public attributes that expose this type of data. My use case is reporting malformed lines detected when my code validates the dict of data returned

[issue28134] socket.socket(fileno=fd) does not work as documented

2016-09-21 Thread Christian Heimes
Changes by Christian Heimes : -- assignee: -> christian.heimes components: +Extension Modules stage: needs patch -> patch review ___ Python tracker

[issue28228] imghdr does not support pathlib

2016-09-21 Thread Ethan Furman
New submission from Ethan Furman: Supporting pathlib was one of the requirements of removing the provisional status. Why have you changed the type to enhancement? -- ___ Python tracker

[issue26072] pdb fails to access variables closed over

2016-09-21 Thread Jesús Gómez
Jesús Gómez added the comment: Confirming. Another use case is the use any lambda, or function definition inside the scope of a function, for checking conditions in the REPL. Suppose two inner functions named condition1 and condition2, and a parameter X as a Collection: (Pdb)

[issue28243] Performance regression in functools.partial()

2016-09-21 Thread STINNER Victor
STINNER Victor added the comment: Oh, functools.partial.__call__() doesn't use fastcall yet. So compared to Python 3.5, fastcall shouldn't explain a major performance difference. FYI I'm working on an extension of fastcall to also support fastcall calling convention for obj.__call__() ;-)

[issue28197] range.index mismatch with documentation

2016-09-21 Thread Vedran Čačić
Vedran Čačić added the comment: Why can't this go into 3.6? To me this situation seems like a bug. -- ___ Python tracker ___

Re: csjark module

2016-09-21 Thread Peter Otten
bezen...@gmail.com wrote: > On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: >> bezen...@gmail.com wrote: >> >> > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten >> > wrote: >> >> bezen...@gmail.com wrote: >> >> >> >> > On Wednesday, September 21, 2016

[issue28243] Performance regression in functools.partial()

2016-09-21 Thread STINNER Victor
STINNER Victor added the comment: The perf regression can be related to the new fastcall calling convention or the work in ceval.c (new 16-bit regular bytecode, new CALL_FUNCTION bytecodes). -- ___ Python tracker

Re: list or dictionary

2016-09-21 Thread Ganesh Pal
Thanks , and it has to be re.match() On Thu, Sep 22, 2016 at 12:18 AM, MRAB wrote: > On 2016-09-21 19:35, Ganesh Pal wrote: > >> Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen >> to work. >> >> >> for line in hostname: > ...

Re: list or dictionary

2016-09-21 Thread MRAB
On 2016-09-21 19:35, Ganesh Pal wrote: Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen to work. for line in hostname: ... regex = r'(.*) is array with id {}'.format(devid) ... mo = re.search(regex, line) ... print line, regex, mo ... if mo is not

Re: list or dictionary

2016-09-21 Thread Ganesh Pal
Thanks Steve for the clues , quickly tried out # Version 1 doesn't seen to work. >>> for line in hostname: ... regex = r'(.*) is array with id {}'.format(devid) ... mo = re.search(regex, line) ... print line, regex, mo ... if mo is not None: ... print mo.group(1) ...

[issue28240] Enhance the timeit module: display average +- std dev instead of minimum

2016-09-21 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: We had a similar discussion a while back for pybench. Consensus then was to use the minimum as basis for benchmarking: https://mail.python.org/pipermail/python-dev/2006-June/065525.html I had used the average before this discussion in pybench 1.0:

[issue28243] Performance regression in functools.partial()

2016-09-21 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: There is 10% performance regression in calling functools.partial() in 3.6. $ ./python -m perf timeit -s 'from functools import partial; f = lambda x, y: None; g = partial(f, 1)' -- 'g(2)' Python 3.5: Median +- std dev: 452 ns +- 25 ns Python 3.6: Median

[issue28242] os.environ.get documentation missing

2016-09-21 Thread Ned Deily
Ned Deily added the comment: The difference is that os.environ is a reference to a mapping object, essentially a dict, that has all of the process environment variables. By using the get('x') method on that object, you ask the object to find and return the value corresponding to key 'x' or to

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten > >> >

Re: csjark module

2016-09-21 Thread bezenchu
On Wednesday, September 21, 2016 at 5:15:38 PM UTC+3, Peter Otten wrote: > bezen...@gmail.com wrote: > > > On Wednesday, September 21, 2016 at 3:17:11 PM UTC+3, Peter Otten wrote: > >> bezen...@gmail.com wrote: > >> > >> > On Wednesday, September 21, 2016 at 1:14:14 PM UTC+3, Peter Otten > >> >

Re: Another å, ä, ö question

2016-09-21 Thread Martin Schöön
Den 2016-09-20 skrev Peter Otten <__pete...@web.de>: > Martin Schöön wrote: > >> Den 2016-09-19 skrev Christian Gollwitzer : >>> Am 19.09.16 um 22:21 schrieb Martin Schöön: I am studying some of these tutorials: https://pythonprogramming.net/matplotlib-intro-tutorial/

Re: Another å, ä, ö question

2016-09-21 Thread Martin Schöön
Den 2016-09-20 skrev Chris Angelico : > On Wed, Sep 21, 2016 at 6:21 AM, Martin Schöön > wrote: >> Den 2016-09-19 skrev Lawrence D’Oliveiro : >>> On Tuesday, September 20, 2016 at 8:21:25 AM UTC+12, Martin Schöön wrote: But

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Chris Angelico
On Thu, Sep 22, 2016 at 3:32 AM, Ian Kelly wrote: > On Tue, Sep 20, 2016 at 11:03 AM, Rob Gaddi > wrote: >> The only thing that's O(N log N) in that is the number of actual yield >> calls. If you're doing pretty much anything with those

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Chris Angelico
On Thu, Sep 22, 2016 at 3:15 AM, Random832 wrote: > Or you can give up on recursion. Recursive tree traversal is generally > associated with passing in a callback in rather than implementing an > iterable-like interface that can be used with a caller's for-loop > anyway. >

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Ian Kelly
On Tue, Sep 20, 2016 at 11:03 AM, Rob Gaddi wrote: > The only thing that's O(N log N) in that is the number of actual yield > calls. If you're doing pretty much anything with those values as > they're being iterated over then they'll dominate the timing, and

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Random832
On Wed, Sep 21, 2016, at 10:39, ROGER GRAYDON CHRISTMAN wrote: > Which only highlights my disappointment that my tree > traversal itself was O(n log n), unless I gave up on yield. Or you can give up on recursion. Recursive tree traversal is generally associated with passing in a callback in

Re: pypy on windows much slower than linux/mac when using complex number type?

2016-09-21 Thread Irmen de Jong
On 21-9-2016 1:20, Chris Kaynor wrote: > > Regarding the performance decrease, it may be worthwhile to push the report > to a PyPy specific forum - a PyPy developer will probably see it here, but > you may get a faster response on a forum specific to PyPy. You're right. I don't know the best

[issue28235] In xml.etree.ElementTree docs there is no parser argument in fromstring()

2016-09-21 Thread Berker Peksag
Berker Peksag added the comment: Instead of duplicating XML() documentation, I'd suggest changing fromstring() documentation to say something like "this is an alias for ElementTree.XML()." -- nosy: +berker.peksag versions: +Python 3.5, Python 3.7

[issue16487] Allow ssl certificates to be specified from memory rather than files.

2016-09-21 Thread Jan-Philip Gehrcke
Jan-Philip Gehrcke added the comment: Thanks Christian, much appreciated. Just responded to your review. -- ___ Python tracker ___

[issue28241] Nested fuctions Unexpected behaviour when stored in a list and called after.

2016-09-21 Thread artxyz
artxyz added the comment: I got it now. Thanks! -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue28242] os.environ.get documentation missing

2016-09-21 Thread Dennis Jensen
Changes by Dennis Jensen : -- status: pending -> open ___ Python tracker ___ ___

[issue25651] Confusing output for TestCase.subTest(0)

2016-09-21 Thread Berker Peksag
Berker Peksag added the comment: Fixed. I lost some time because of this today :) -- nosy: +berker.peksag resolution: -> fixed stage: test needed -> resolved status: open -> closed versions: +Python 3.7 -Python 3.4 ___ Python tracker

[issue28234] In xml.etree.ElementTree docs there are many absent Element class links

2016-09-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +eli.bendersky, scoder stage: -> patch review ___ Python tracker ___

[issue28239] Implement functools.lru_cache() using ordered dict

2016-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I consider this issue as lying on the way to using the orderable of dict in OrderedDict implementation (the latter is very desirable because current OrderedDict implementation can be easily broken by using plain dict API). The main difficulty of

[issue28235] In xml.etree.ElementTree docs there is no parser argument in fromstring()

2016-09-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: -> patch review ___ Python tracker ___

[issue25651] Confusing output for TestCase.subTest(0)

2016-09-21 Thread Roundup Robot
Roundup Robot added the comment: New changeset ba743894e793 by Berker Peksag in branch '3.5': Issue #25651: Allow falsy values to be used for msg parameter of subTest() https://hg.python.org/cpython/rev/ba743894e793 New changeset ddbf92168a44 by Berker Peksag in branch '3.6': Issue #25651:

[issue28235] In xml.etree.ElementTree docs there is no parser argument in fromstring()

2016-09-21 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +eli.bendersky, scoder ___ Python tracker ___

[issue28242] os.environ.get documentation missing

2016-09-21 Thread Dennis Jensen
Dennis Jensen added the comment: Okay well thanks for that information but after investigating this then I have to ask what is the difference between: os.environ.get() and os.getenv() As these 2 functions now appear to do exactly the same thing? If this is the case then should there not

[issue28241] Nested fuctions Unexpected behaviour when stored in a list and called after.

2016-09-21 Thread R. David Murray
R. David Murray added the comment: Note also that your first example worked only because your loop variable was named i. If you used, say, 'j', you'd get the same result as in your second example. This is because the closure is over the named variable, and both in your definition loop and

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread Chris Angelico
On Thu, Sep 22, 2016 at 12:39 AM, ROGER GRAYDON CHRISTMAN wrote: > Which only highlights my disappointment that my tree > traversal itself was O(n log n), unless I gave up on yield. > As a teacher I'm stuck with either > a) a data structure that can only get its maximal speed >

Python for .NET (pythonnet) 2.2.0.dev1 new development release available

2016-09-21 Thread Denis Akhiyarov
Hello Python and .NET developers, New pythonnet 2.2.0.dev1 version with (pre-)release notes are available for download from PYPI and GitHub: https://pypi.python.org/pypi/pythonnet/2.2.0.dev1 Note that since this is pre-release, use this command for installation: pip install pythonnet --pre -U

[issue26513] platform.win32_ver() broken in 2.7.11

2016-09-21 Thread Roundup Robot
Roundup Robot added the comment: New changeset 03f2c8fc24ea by Steve Dower in branch '2.7': Issue #26513: Use winver.product_type instead of .product https://hg.python.org/cpython/rev/03f2c8fc24ea -- ___ Python tracker

[issue27932] platform.win32_ver() leaks in 2.7.12

2016-09-21 Thread Steve Dower
Changes by Steve Dower : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

Re: automated comparison tool

2016-09-21 Thread Andrew Clark
I reinstalled paramiko and now i'm getting a slighty different error but still says no cryptography. Traceback (most recent call last): File "C:\Users\ac40935\workspace\AutoCompare\filecmp.py", line 6, in from paramiko import SSHConfig, SSHClient File

Re: get the sum of differences between integers in a list

2016-09-21 Thread marco . nawijn
On Wednesday, September 21, 2016 at 4:14:10 PM UTC+2, Daiyue Weng wrote: > Hi, first of all, let me rephase the problem. > > For an arbitrary list of integers (the integers in the list are not > necessary to be sequential), e.g. [1,2,3,6,8,9,10,11,13], > > if a set of consecutive integers having

Re: automated comparison tool

2016-09-21 Thread Andrew Clark
On Tuesday, September 20, 2016 at 7:48:20 PM UTC-5, Steve D'Aprano wrote: > On Wed, 21 Sep 2016 07:20 am, Andrew Clark wrote: > > > I've restarted my code so many times i no longer have a working version of > > anything. > > > *Restarting* your code doesn't change it and cannot possibly stop it

[issue28242] os.environ.get documentation missing

2016-09-21 Thread Ned Deily
Ned Deily added the comment: os.environ is documented as being a "mapping" object. The "get" method is a standard method for all mapping objects; it's not unique to os.environ. Thus, there is no need to specially call out "get" or any of the other "mapping" methods and operations available

[issue28100] Refactor error messages in symtable.c

2016-09-21 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Here is the patch for 3.6 with requested changes. While playing with this a bit more, I discovered that the error message in this case (if no value is actually assigned): def f(): x: int global x could be misleading. Therefore I changed the order of

[issue28197] range.index mismatch with documentation

2016-09-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: > 2) Add the support of stop and start arguments to range() in 3.7. Yes, the whole point of adding these bogus methods in the first place was to harmonize the range object with other sequence types. -- ___

[issue28197] range.index mismatch with documentation

2016-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry for poor words. I was not going to blame anybody. But changing interface always is dangerous. It makes third-party classes that implemented the interface no longer valid substitutions. I think two things are worth to be done: 1) Explicitly document

[issue28240] Enhance the timeit module

2016-09-21 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka added the comment: >> * Change the default repeat from 3 to 5 to have a better distribution of >> timings. It makes the timeit CLI 66% slower (ex: 1 second instead of 600 >> ms). That's the price of stable benchmarks :-) > > For now default

[issue28241] Nested fuctions Unexpected behaviour when stored in a list and called after.

2016-09-21 Thread Zachary Ware
Zachary Ware added the comment: See https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result Note that `lambda: x**2` is equivalent to `def FUN(): return x**2`. -- nosy: +zach.ware resolution: -> not a bug stage:

[issue28242] os.environ.get documentation missing

2016-09-21 Thread Dennis Jensen
New submission from Dennis Jensen: I was encountering what seemed to be odd behavior from os.environ.get() from what I could find out about it and so I tried to locate the actual documentation on how it is supposed to be used now. However, all I can find is a minor reference to os.environ.

[issue28214] Improve exception reporting for problematic __set_name__ attributes

2016-09-21 Thread Nick Coghlan
Nick Coghlan added the comment: @property can be used to define a broken __set_name__ attribute: >>> class BadIdea: ... @property ... def __set_name__(self): ... pass ... >>> class NotGoingToWork: ... attr = BadIdea() ... Traceback (most recent call last): File "", line

[issue28240] Enhance the timeit module

2016-09-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > * Display the average, rather than the minimum, of the timings *and* display > the standard deviation. It should help a little bit to get more reproductible > results. This makes hard to compare results with older Python versions. > * Change the default

[issue28241] Nested fuctions Unexpected behaviour when stored in a list and called after.

2016-09-21 Thread artxyz
New submission from artxyz: Python 2.7.11 GCC 4.8.4 Getting weird results when define a nested function in a loop and store them in a list x = list() for i in xrange(5): def FUN(): print i x.append(FUN) Calling functions from list using index works fine:

Re: get the sum of differences between integers in a list

2016-09-21 Thread Peter Otten
Peter Otten wrote: > This is not as efficient as it should be -- the gaps are calculated twice, > the check for the first and the last position is repeated on every > iteration lots of packing and unpacking... -- To address some of my own criticism: def lonely(triple): left, value, right =

[issue28197] range.index mismatch with documentation

2016-09-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'd argue that range can implement the 3-arg .index much better > than generic Sequence. Yes, the range index() method should implement all three arguments. That shouldn't be difficult. -- assignee: docs@python -> type: behavior -> enhancement

[issue28210] argparse with subcommands difference in python 2.7 / 3.5

2016-09-21 Thread Tim Graham
Tim Graham added the comment: Based on the usage output, it looks like the subcommand is required, but I'm not sure if there are cases where a subcommand could be optional. David, can you advise? usage: test_argparse.py [-h] command ... -- nosy: +r.david.murray

[issue28202] Python 3.5.1 C API, the global variable is not destroyed when delete the module

2016-09-21 Thread Nick Coghlan
Nick Coghlan added the comment: To be entirely clear about what's going on, the reference cycle seen in the example arises for *any* module level function, even if it's completely empty: >>> def f(): ... pass ... >>> f.__globals__["f"] is f True The existence of that cycle will then keep

[issue28239] Implement functools.lru_cache() using ordered dict

2016-09-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: The problem is that cache hits now create "holes" in the compact dict and trigger periodic compaction. In contrast, the existing code leaves dicts unchanged when there is a cache hit. I prefer the current code. Though it took a little more effort to

[issue28202] Python 3.5.1 C API, the global variable is not destroyed when delete the module

2016-09-21 Thread Nick Coghlan
Nick Coghlan added the comment: The most likely relevant difference here is that Python 3.4+ no longer forcibly break cycles through the module globals when the module is deallocated: https://docs.python.org/dev/whatsnew/3.4.html#whatsnew-pep-442 Due to the implicit cycles created between

Re: strings and ints consistency - isinstance

2016-09-21 Thread Ned Batchelder
On Wednesday, September 21, 2016 at 10:27:15 AM UTC-4, Sayth Renshaw wrote: > Hi > > Trying to clarify why ints and strings arent treated the same. > > You can get a valuerror from trying to cast a non-int to an int as in > int(3.0) however you cannot do a non string with str(a). > > Which

[issue28100] Refactor error messages in symtable.c

2016-09-21 Thread Christian Heimes
Christian Heimes added the comment: Please rewrite the patch to use if / else if / else, e.g. if (cur & (DEF_LOCAL | USE | DEF_ANNOT)) { ... if (cur & USE) { msg = GLOBAL_AFTER_USE; } else if (cur & DEF_LOCAL) { msg = GLOBAL_AFTER_ASSIGN; } else { /* DEF_ANNOT

Re: Linear Time Tree Traversal Generator

2016-09-21 Thread ROGER GRAYDON CHRISTMAN
Since I was asked how I got different running times for my two code fragments, I'll try to apply them to a very simple tree: 4 2 6 1 3 5 7 >def __iter__(node): > for x in iter(node._left): > yield x > yield node._value > for x in

Re: get the sum of differences between integers in a list

2016-09-21 Thread Peter Otten
Daiyue Weng wrote: > Hi, first of all, let me rephase the problem. > > For an arbitrary list of integers (the integers in the list are not > necessary to be sequential), e.g. [1,2,3,6,8,9,10,11,13], > > if a set of consecutive integers having a difference of 1 between them, > put them in a

[issue28240] Enhance the timeit module

2016-09-21 Thread Yury Selivanov
Changes by Yury Selivanov : -- nosy: -yselivanov ___ Python tracker ___ ___

[issue28240] Enhance the timeit module

2016-09-21 Thread STINNER Victor
STINNER Victor added the comment: > Another point: timeit is often used to compare performance between Python > versions. By changing the behaviour of timeit in a given Python version, > you'll make it more difficult to compare results. Hum, that's a good argument against my change :-) So to

[issue28239] Implement functools.lru_cache() using ordered dict

2016-09-21 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___

[issue28240] Enhance the timeit module

2016-09-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: > * Display the average, rather than the minimum, of the timings *and* > display the standard deviation. It should help a little bit to get > more reproductible results. I'm still not convinced that the average is the right statistic to use here. I cannot

strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
Hi Trying to clarify why ints and strings arent treated the same. You can get a valuerror from trying to cast a non-int to an int as in int(3.0) however you cannot do a non string with str(a). Which means that you likely should use try and except to test if a user enters a non-int with

[issue28240] Enhance the timeit module: display average +- std dev instead of minimum

2016-09-21 Thread STINNER Victor
STINNER Victor added the comment: Maciej Fijalkowski also sent me the following article a few months ago, it also explains indirectly why using the minimum for benchmarks is not reliable: "Virtual Machine Warmup Blows Hot and Cold" http://arxiv.org/pdf/1602.00602.pdf Even if the article is

  1   2   >