[issue28969] lru_cache is not threadsafe

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: With Antoine's suggestion lru_cache-dict-pop-simpler-3.5.patch no longer has an advantage. Just ignore it. -- ___ Python tracker

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: patch review -> resolved ___ Python tracker ___

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue29200] is it a bug in `functools._HashedSeq`

2017-01-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: -> resolved ___ Python tracker ___ ___

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Deborah Swanson
Steven D'Aprano wrote, on January 08, 2017 7:30 PM > > On Sunday 08 January 2017 20:53, Deborah Swanson wrote: > > > Steven D'Aprano wrote, on January 07, 2017 10:43 PM > > No, I'm pretty sure that's not the case. I don't have access > to your CSV file, > but I can simulate it: > > ls =

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Deborah Swanson
Peter Otten wrote, on January 08, 2017 5:21 AM > > Deborah Swanson wrote: > > > Peter Otten wrote, on January 08, 2017 3:01 AM > > Personally I would recommend against mixing data (an actual location) and > metadata (the column name,"Location"), but if you wish my code can be > adapted as

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Deborah Swanson
Steven D'Aprano wrote, on January 07, 2017 10:43 PM > > On Sunday 08 January 2017 16:39, Deborah Swanson wrote: > > The recommended way is with the _replace method: > > py> instance._replace(A=999) > Record(A=999, B=20, C=30) > py> instance._replace(A=999, C=888) > Record(A=999, B=20, C=888) >

Re: Python for WEB-page !?

2017-01-08 Thread Eric S. Johansson
On 1/5/2017 7:48 PM, Michael Torrie wrote: > While Python can do that, using a web framework to process HTTP requests > and generate HTML to display in the browser, I don't believe Python is > the appropriate language for the task at hand. Most web sites that do > interactive formula calculations

Re: Temporary variables in list comprehensions

2017-01-08 Thread Rustom Mody
On Monday, January 9, 2017 at 10:19:31 AM UTC+5:30, Steven D'Aprano wrote: > On Monday 09 January 2017 15:09, Chris Angelico wrote: > > > On Mon, Jan 9, 2017 at 2:53 PM, Steven D'Aprano wrote: > >> [(tmp, tmp + 1) for x in data for tmp in [expensive_calculation(x)]] > >> > >> > >> I can't decide

[issue29142] urllib: no_proxy variable values with leading dot not properly handled

2017-01-08 Thread Xiang Zhang
Xiang Zhang added the comment: Thanks Milan and Thomas! -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker

[issue29145] failing overflow checks in replace_*

2017-01-08 Thread Xiang Zhang
Xiang Zhang added the comment: > FTR I thought the consensus was not to backport these fixes unless there was > a demonstrated problem: , though > personally, I would be in favour of backporting in many cases. Sorry not know that. :-( Another

[issue29212] Python 3.6 logging thread name regression with concurrent.future threads

2017-01-08 Thread desbma
New submission from desbma: Logging statement using 'threadName' from concurrent.futures threads produce the wrong output with Python 3.6. The attached program with Python 3.5.X outputs: MainThread From main thread Thread-1 From worker thread But with 3.6, it outputs: MainThread From main

Re: Temporary variables in list comprehensions

2017-01-08 Thread Chris Angelico
On Mon, Jan 9, 2017 at 3:49 PM, Steven D'Aprano wrote: > Helper functions are good. Helper functions that are only used > *once* are a code smell. *LOTS* of helper functions that are only used once > are > a sign that something is horrible, and it might just

Re: Temporary variables in list comprehensions

2017-01-08 Thread Steven D'Aprano
On Monday 09 January 2017 15:09, Chris Angelico wrote: > On Mon, Jan 9, 2017 at 2:53 PM, Steven D'Aprano > wrote: >> [(tmp, tmp + 1) for x in data for tmp in [expensive_calculation(x)]] >> >> >> I can't decide whether that's an awesome trick or a horrible

[issue29145] failing overflow checks in replace_*

2017-01-08 Thread Martin Panter
Martin Panter added the comment: FTR I thought the consensus was not to backport these fixes unless there was a demonstrated problem: , though personally, I would be in favour of backporting in many cases. Regarding str.join() in unicode.c, see

[issue1621] Do not assume signed integer overflow behavior

2017-01-08 Thread Martin Panter
Changes by Martin Panter : -- dependencies: +failing overflow checks in replace_* ___ Python tracker ___

Re: Temporary variables in list comprehensions

2017-01-08 Thread Chris Angelico
On Mon, Jan 9, 2017 at 2:53 PM, Steven D'Aprano wrote: > [(tmp, tmp + 1) for x in data for tmp in [expensive_calculation(x)]] > > > I can't decide whether that's an awesome trick or a horrible hack... A horrible hack on par with abusing a recursive

[issue29142] urllib: no_proxy variable values with leading dot not properly handled

2017-01-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset cb4f73be9486 by Xiang Zhang in branch '2.7': Issue #29142: Fix suffixes in no_proxy handling in urllib. https://hg.python.org/cpython/rev/cb4f73be9486 New changeset 350c5a1f9cfd by Xiang Zhang in branch '3.5': Issue #29142: Fix suffixes in no_proxy

Temporary variables in list comprehensions

2017-01-08 Thread Steven D'Aprano
Suppose you have an expensive calculation that gets used two or more times in a loop. The obvious way to avoid calculating it twice in an ordinary loop is with a temporary variable: result = [] for x in data: tmp = expensive_calculation(x) result.append((tmp, tmp+1)) But what if you

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Steven D'Aprano
On Sunday 08 January 2017 20:53, Deborah Swanson wrote: > Steven D'Aprano wrote, on January 07, 2017 10:43 PM >> >> On Sunday 08 January 2017 16:39, Deborah Swanson wrote: >> >> > What I've done so far: >> > >> > with open('E:\\Coding projects\\Pycharm\\Moving\\Moving >> 2017 in.csv', >> >

[issue29145] failing overflow checks in replace_*

2017-01-08 Thread Xiang Zhang
Xiang Zhang added the comment: I committed the patch to 2.7. The new patch is for 3.x. -- stage: patch review -> commit review versions: +Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file46221/overflow-checks-3x.patch ___

RE: Grumpy: Python to Go compiler

2017-01-08 Thread Deborah Swanson
Tim Daneliuk wrote, on January 08, 2017 4:49 PM > > On 01/08/2017 06:18 PM, Deborah Swanson wrote: > > (haha, unless > > you ask) > > C'mon, go for it ... there hasn't been a good rant here in > 4 or 5 minutes ... Oh hell. (How do I tell him I was up til 8am this morning, only got a few hours

[issue29145] failing overflow checks in replace_*

2017-01-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 29e505526bdd by Xiang Zhang in branch '2.7': Issue #29145: Fix overflow checks in string, bytearray and unicode. https://hg.python.org/cpython/rev/29e505526bdd -- nosy: +python-dev ___ Python tracker

[issue29142] urllib: no_proxy variable values with leading dot not properly handled

2017-01-08 Thread Xiang Zhang
Xiang Zhang added the comment: LGTM. -- assignee: -> xiang.zhang stage: patch review -> commit review ___ Python tracker ___

[issue29206] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread Nick Coghlan
Nick Coghlan added the comment: Since reload re-uses the existing namespace, having two names is less messy when they're just aliases for the same module object (it still has all the usual cache validity problems of any reload operation, but it doesn't have the extra challenges of two

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset cc47d385512b by Raymond Hettinger in branch 'default': Complete the merge for issue #29203 https://hg.python.org/cpython/rev/cc47d385512b -- ___ Python tracker

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 48c750c26710 by Raymond Hettinger in branch '3.6': Issue #29203: functools.lru_cache() now respects PEP 468 https://hg.python.org/cpython/rev/48c750c26710 -- nosy: +python-dev ___ Python tracker

Re: Grumpy: Python to Go compiler

2017-01-08 Thread Tim Daneliuk
On 01/08/2017 06:18 PM, Deborah Swanson wrote: > (haha, unless > you ask) C'mon, go for it ... there hasn't been a good rant here in 4 or 5 minutes ... -- https://mail.python.org/mailman/listinfo/python-list

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Antonio Caminero Garcia
On Friday, January 6, 2017 at 6:04:33 AM UTC-8, Peter Otten wrote: > Example: you are looking for the minimum absolute value in a series of > integers. As soon as you encounter the first 0 it's unnecessary extra work > to check the remaining values, but the builtin min() will continue. > > The

RE: Grumpy: Python to Go compiler

2017-01-08 Thread Deborah Swanson
Steven D'Aprano wrote, on January 07, 2017 11:37 PM > > Grumpy, an experimental project from Google, transpiles > Python code into Go, allowing Python programs to be compiled > and run as static binaries using the Go toolchain. > > >

[issue29208] BlockingIOError during system startup

2017-01-08 Thread Martin Panter
Martin Panter added the comment: David you are right, thanks. Dustin: the exact patch you want is revision 0a55e039d25f. -- resolution: -> duplicate status: open -> closed superseder: -> Python 3.6 on Windows doesn't seed Random() well enough ___

[issue29198] AsyncGenerator is missing from typing

2017-01-08 Thread Jelle Zijlstra
Changes by Jelle Zijlstra : Added file: http://bugs.python.org/file46220/typingindentation.patch ___ Python tracker ___

[issue29198] AsyncGenerator is missing from typing

2017-01-08 Thread Jelle Zijlstra
Changes by Jelle Zijlstra : Added file: http://bugs.python.org/file46219/asyncgenerator3.patch ___ Python tracker ___

Re: Using sudo with pip3?

2017-01-08 Thread Hans-Peter Jansen
On Samstag, 7. Januar 2017 19:07:55 Clint Moyer wrote: > I would lightly advise against, assuming both Pip and your package > manager are trying to accomplish nearly the same thing. Stick with > updating through the repo. > > If you find that the version your OS provides is out-of-date compared >

[issue29208] BlockingIOError during system startup

2017-01-08 Thread Dustin Spicuzza
Dustin Spicuzza added the comment: I'll try applying that fix tomorrow and see if the issue is addressed. -- ___ Python tracker ___

[issue29208] BlockingIOError during system startup

2017-01-08 Thread David Vo
David Vo added the comment: It looks like this was already fixed in issue 29085. -- nosy: +auscompgeek ___ Python tracker ___

[issue29195] Get rid of supporting outdated wrong keyword arguments in re methods

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: "pattern" is not more informative, it is just wrong. The argument of the match() method is not a pattern, it is a string with which a pattern is matched. -- ___ Python tracker

[issue28759] access to mkfifo, mknod and hard links is controled by SELinux MAC on Android

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think it is worth to add special helper in test.support for using as a context manager: with helper(): os.mkfifo(filename) Then you could change its implementation without changing the testing code. For example: @contextmanager def

[issue29208] BlockingIOError during system startup

2017-01-08 Thread Martin Panter
Martin Panter added the comment: It looks like the logic for handling an error seeding from urandom is reversed: . Random_seed_urandom() actually returns -1 if is an exception set, and 0 if it was successful. The result would be a normal

[issue29211] assertRaises with exceptions re-raised from a generator kills generator

2017-01-08 Thread Andrew Dalke
New submission from Andrew Dalke: The unittest assertRaises/assertRaisesRegex implementation calls traceback.clear_frames() because of issue9815 ("assertRaises as a context manager keeps tracebacks and frames alive"). However, if the traceback is from an exception created in a generator,

[issue28759] access to mkfifo, mknod and hard links is controled by SELinux MAC on Android

2017-01-08 Thread Xavier de Gaye
Xavier de Gaye added the comment: Re-opening the issue for a more generic change that skips the tests when PermissionError is raised instead of when they are run by an Android non-root user as this is done currently after the previously pushed changes. -- resolution: fixed -> stage:

Nikola v7.8.2 is out!

2017-01-08 Thread Chris Warrick
On behalf of the Nikola team, I am pleased to announce the immediate availability of Nikola v7.8.2. It adds a ton of new features, while also fixing some bugs. Key Changes === * A rewrite of all taxonomies (tags, categories, sections, etc.) in a generic fashion, allowing for much

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Deborah Swanson
Paul Rudin wrote, on January 08, 2017 6:49 AM > > "Deborah Swanson" writes: > > > Peter Otten wrote, on January 08, 2017 3:01 AM > >> > >> columnA = [record.A for record in records] > > > > This is very neat. Something like a list comprehension for named > > tuples?

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Jussi Piitulainen writes: > It could still be added as an option, to both takewhile and iter(_, _). That's too messy, it really should be pervasive in iterators. -- https://mail.python.org/mailman/listinfo/python-list

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Peter Otten <__pete...@web.de> writes: > return min(take_until(), key=firstitem)[1] Actually, key=abs should work. I realized that after posting. -- https://mail.python.org/mailman/listinfo/python-list

[issue28167] remove platform.linux_distribution()

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: But platform.dist() can be removed. It was deprecated in 2.6. -- nosy: +serhiy.storchaka ___ Python tracker ___

[issue29206] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread Brett Cannon
Brett Cannon added the comment: The error from using -m stems from runpy not aliasing the module as both "__main__" and "reloader". I suspect the reason is that having a module under two names gets really messy because if you update just one of those modules you leave the other one around

[issue29210] Remove the support of the exclude argument in tarfile.TarFile.add()

2017-01-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch removes the support of the exclude argument in tarfile.TarFile.add(). It was deprecated in 2.7 and 3.2. The filter argument that supersedes it is available in all maintained releases. -- components: Library (Lib) files:

[issue29207] make install fails on ARM

2017-01-08 Thread petevine
petevine added the comment: In case a clue might be gleaned right away from `make test`, I'm posting the final part of the output here: [394/401/1] test_xmlrpc ../Python-2.7.13/Lib/threading.py:846: DeprecationWarning: sys.exc_clear() not supported in 3.x; use except clauses

[ANN] pyspread 1.1

2017-01-08 Thread Martin Manns
== pyspread 1.1 == Pyspread 1.1 has been released. About pyspread == Pyspread is a non-traditional spreadsheet application that is based on and written in the programming language Python. The goal of pyspread is to be the most pythonic spreadsheet

StdConfigParser 1.0 release

2017-01-08 Thread news
Announcing the release of StdConfigParser 1.0 What is it? --- This is the Python configparser with an extra class StdConfigParser. The StdConfigParser class uses specified parameters to initialize the Python ConfigParser and adds some useful converters. The result is a simple well

[RELEASED] Python 3.4.6rc1 and Python 3.5.3rc1 are now available

2017-01-08 Thread news
On behalf of the Python development community and the Python 3.4 and Python 3.5 release teams, I'm pleased to announce the availability of Python 3.4.6rc1 and Python 3.5.6rc1. Python 3.4 is now in "security fixes only" mode. This is the final stage of support for Python 3.4. Python 3.4 now

NumPy 1.12.0rc2 release.

2017-01-08 Thread news
Hi All, I'm pleased to announce the NumPy 1.12.0rc2 New Year's release. This release supports Python 2.7 and 3.4-3.6. Wheels for all supported Python versions may be downloaded from PiPY , the tarball and zip files may be downloaded from

2017: Call for workshop, symposium & poster submissions

2017-01-08 Thread Tim Molderez
--- 2017 : The Art, Science, and Engineering of Programming April 3-6, 2017, Brussels, Belgium http://2017.programming-conference.org --- We are excited

cx_Freeze 5.0.1

2017-01-08 Thread Anthony Tuininga
What is cx_Freeze? cx_Freeze is a set of scripts and modules for freezing Python scripts into executables, in much the same way that py2exe and py2app do. Unlike these two tools, cx_Freeze is cross platform and should work on any platform that Python itself works on. It supports Python 2.7 or

ANN: Python Events Calendar - Please submit your 2017 events

2017-01-08 Thread M.-A. Lemburg
[Please help spread the word by forwarding to other relevant mailing lists, user groups, etc. world-wide; thanks :-)] ANNOUNCING Python Events Calendars - Please submit your 2017 events maintained by

[issue29209] Remove old-deprecated ElementTree features

2017-01-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Add code deprecations in ElementTree ___ Python tracker ___

[issue29209] Remove old-deprecated ElementTree features

2017-01-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch removes old-deprecated ElementTree features. * Methods Element.getchildren(), Element.getiterator() and ElementTree.getiterator() deprecated in 2.7 and 3.2. Use list(elem) or iteration instead of getchildren(), methods iter() instead of

[issue29034] Fix memory leak and use-after-free in path_converter

2017-01-08 Thread Xiang Zhang
Xiang Zhang added the comment: > Is 3.5 free from all these bugs? path_converter is much simpler in 3.5 so I think it's free of these bugs. :-) -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker

[issue29208] BlockingIOError during system startup

2017-01-08 Thread Dustin Spicuzza
Dustin Spicuzza added the comment: Crap, after reading more carefully, I see that PEP was rejected in favor of PEP 524. According to that PEP, then I must implement the wait_for_system_rng() function? It's a bit weird, because I'm not explicitly using the random module and don't care to use

[issue29034] Fix memory leak and use-after-free in path_converter

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is 3.5 free from all these bugs? -- ___ Python tracker ___ ___

[issue29208] BlockingIOError during system startup

2017-01-08 Thread Dustin Spicuzza
New submission from Dustin Spicuzza: I haven't dug into this very deeply yet, so I'm seeking some clarity on this issue before doing so. According to my reading of PEP 522 (https://www.python.org/dev/peps/pep-0522/), BlockingIOError will be raised in security sensitive APIs, but not when just

[issue29180] skip tests that raise PermissionError in test_os (non-root user on Android)

2017-01-08 Thread Xavier de Gaye
Xavier de Gaye added the comment: > If test_os is the only user of the helper, I'd say let's keep it in > Lib/test/test_os.py for now. I agree with that concern. support.os_link() is also used by a patch in issue 29181, and I am planning to modify the changes made by issue 28759 to also use

[issue29207] make install fails on ARM

2017-01-08 Thread petevine
New submission from petevine: I've just tried installing 2.7.13 on my ARM machine but after a successful build, `make install` fails without any hint what's wrong: Compiling /usr/lib/python2.7/xmllib.py ... Compiling /usr/lib/python2.7/xmlrpclib.py ... Compiling /usr/lib/python2.7/zipfile.py

[issue29034] Fix memory leak and use-after-free in path_converter

2017-01-08 Thread Roundup Robot
Roundup Robot added the comment: New changeset 553eedb8b247 by Xiang Zhang in branch '3.6': Issue #29034: Fix memory leak and use-after-free in path_converter. https://hg.python.org/cpython/rev/553eedb8b247 New changeset 08042f0dbb67 by Xiang Zhang in branch 'default': Issue #29034: Merge 3.6.

Re: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Paul Rudin
"Deborah Swanson" writes: > Peter Otten wrote, on January 08, 2017 3:01 AM >> >> columnA = [record.A for record in records] > > This is very neat. Something like a list comprehension for named tuples? Not something like - this *is* a list comprehension - it creates a

[issue29205] col_offset for AsyncFunctionDef AST nodes is wrong

2017-01-08 Thread Jelle Zijlstra
Changes by Jelle Zijlstra : -- keywords: +patch Added file: http://bugs.python.org/file46215/issue29205.patch ___ Python tracker

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Deborah Swanson
Peter Otten wrote, on January 08, 2017 5:21 AM > > Deborah Swanson wrote: > > > Peter Otten wrote, on January 08, 2017 3:01 AM > >> > >> Deborah Swanson wrote: > >> > >> > to do that is with .fget(). Believe me, I tried every > possible > >> > way > > to > >> > use instance.A or instance[1]

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Peter Otten
Deborah Swanson wrote: > Peter Otten wrote, on January 08, 2017 3:01 AM >> >> Deborah Swanson wrote: >> >> > to do that is with .fget(). Believe me, I tried every > possible way > to >> > use instance.A or instance[1] and no way could I get ls[instance.A]. >> >> Sorry, no. > > I quite agree,

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Jussi Piitulainen
Paul Rubin writes: > I think Python's version of iterators is actually buggy and at least > the first element of the rest of the sequence should be preserved. > There are ways to fake it but they're too messy for something like > this. It should be the default and might have been a good change

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Jussi Piitulainen
Paul Rubin writes: > Jussi Piitulainen writes: >> That would return 0 even when there is no 0 in xs at all. > > Doesn't look that way to me: > > >>> minabs([5,3,1,2,4]) > 1 Sorry about that. I honestly meant to say it would return 1 even when there was a single 0 at the very end. Somehow

[issue29174] 'NoneType' object is not callable in subprocess.py

2017-01-08 Thread ita1024
ita1024 added the comment: > The code in test.py is not realistic. My application uses a process pool that gets freed when my application terminates. > You might have more influence with a realistic use case. I am reporting this because the users of my application are complaining. > Victor

[issue27603] Migrate IDLE context menu items to shell extension

2017-01-08 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- assignee: terry.reedy -> ___ Python tracker ___ ___

[issue29202] Improve dict iteration

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In general the idea LGTM. It it is slightly dangerous if dict structure is broken. j is incremented only when value != NULL, and if ma_used is not correct, this can cause reading out of the end of an array. Of course this should never happen. But if there

[issue29202] Improve dict iteration

2017-01-08 Thread INADA Naoki
INADA Naoki added the comment: While this isn't bugfix, I'm +1 to commit this to 3.6 branch to reduce future maintenance cost. -- ___ Python tracker ___

[issue29202] Improve dict iteration

2017-01-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file46214/dict_shorter_iteration.diff ___ Python tracker ___

[issue29202] Improve dict iteration

2017-01-08 Thread INADA Naoki
INADA Naoki added the comment: patch LGTM. > Since the table is usually dense packed to the left, this will give fewer > loops and fewer memory accesses. Since dk_nentries is "right end of active entries", this patch doesn't affect for "dence packed to the left" dict. But it can affect when

[issue29202] Improve dict iteration

2017-01-08 Thread INADA Naoki
INADA Naoki added the comment: > I'm wondering why new dict implementation don't keep the array of items > compact? Original Raymond's implementation did not preserve the order after > deletions, but saved items in an array without gaps. This could simplify and > speed up an iteration (no

[issue29204] Add code deprecations in ElementTree

2017-01-08 Thread Stefan Behnel
Stefan Behnel added the comment: I'm ok with the deprecations. Regarding the cElementTree module, this is a bit problematic. The idiomatic import has lost its use in Py2.5 when ET and cET were added to the stdlib, so code that was written for Py2.5 or later (e.g. because it uses generators)

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2017-01-08 Thread Stefan Behnel
Stefan Behnel added the comment: Actually, it seems that calling urlcleanup() is sufficient as a work-around. -- ___ Python tracker ___

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Deborah Swanson
Peter Otten wrote, on January 08, 2017 3:01 AM > > Deborah Swanson wrote: > > > to do that is with .fget(). Believe me, I tried every > possible way to > > use instance.A or instance[1] and no way could I get ls[instance.A]. > > Sorry, no. I quite agree, I was describing the dead end I was in

[issue29204] Add code deprecations in ElementTree

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, I have a doubt about this too. Perhaps it can be just removed. The idiomatic code in Python 2 is: try: import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET --

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch that fixes also C implementation and has tests. -- type: performance -> behavior versions: +Python 3.6 Added file: http://bugs.python.org/file46213/lru_cache_pep468.patch ___ Python tracker

[issue29206] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread John Lehmann
John Lehmann added the comment: I may not have been clear as to how the problem seems when working with a web.py application: * visit the web page, see something that needs fixing * make the required change to app.py * reload the webpage * error occurs --

[issue29206] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread John Lehmann
New submission from John Lehmann: In testing the py3 port for the web framework web.py, I found a limitation of importlib.reload. A module that was loaded via the command line cannot be reloaded with importlib.reload. The basic mode of operation for web.py is to create a web application as a

[issue29205] col_offset for AsyncFunctionDef AST nodes is wrong

2017-01-08 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: The col_offset is actually correct when there is a decorator: In [26]: code = '@decorator\nasync def f(): pass' In [27]: tree = ast.parse(code) In [28]: tree.body[0].col_offset Out[28]: 0 The same issue appears with async for and async with: In [31]: code =

[issue29204] Add code deprecations in ElementTree

2017-01-08 Thread Martin Panter
Martin Panter added the comment: Isn’t cElementTree useful and recommended in 2.7? It would be awkward to deprecate it in Python 3. But I guess the other cases should be okay to deprecate in 3.7. -- nosy: +martin.panter ___ Python tracker

[issue29194] importlib reload fails for module supplied as argument to command line

2017-01-08 Thread John Lehmann
John Lehmann added the comment: You get a slightly different error using "-m". I'll raise a new defect - with some background that may make the bug seem more reasonable. -- ___ Python tracker

[issue29205] col_offset for AsyncFunctionDef AST nodes is wrong

2017-01-08 Thread Jelle Zijlstra
New submission from Jelle Zijlstra: The col_offset attribute for ast.AsyncFunctionDef objects points to the "def" keyword, not to the "async" keyword that actually starts the node. Test case: In [18]: code = 'async def f(): pass' In [19]: tree = ast.parse(code) In [20]: tree.body[0]

[issue27973] urllib.urlretrieve() fails on second ftp transfer

2017-01-08 Thread Stefan Behnel
Stefan Behnel added the comment: This bug makes the installation of lxml fail on many systems (especially MacOS) when pip installs from sources, because it tries to download its library dependencies from FTP and crashes due to the FTP "error". I guess the current fix is to not use urllib for

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Peter Otten
Paul Rubin wrote: > Paul Rubin writes: >> seems to work, but is ugly. Maybe there's something better. > > def minabs2(xs): > def z(): > for x in xs: > yield abs(x), x > if x==0: break > return min(z())[1]

[issue28997] test_readline.test_nonascii fails on Android

2017-01-08 Thread Martin Panter
Martin Panter added the comment: . Thanks for the explanation. It sounds like the Readline library assumes an ASCII-only locale and sets its “convert-meta” variable to “on”. But Python assumes UTF-8 and inputs b"\xC3\xAB" to the terminal. Readline converts the input to two escape sequences:

[issue29204] Add code deprecations in ElementTree

2017-01-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +eli.bendersky, scoder ___ Python tracker ___

[issue29204] Add code deprecations in ElementTree

2017-01-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Some deprecated ElementTree features are deprecated only in the documentation or in Python implementation (that is virtually the same since C implementation is default). Proposed patch adds missed deprecations is code. It also makes warnings be ignored

RE: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Peter Otten
Deborah Swanson wrote: > to do that is with .fget(). Believe me, I tried every possible way to > use instance.A or instance[1] and no way could I get ls[instance.A]. Sorry, no. To get a list of namedtuple instances use: rows = csv.reader(infile) Record = namedtuple("Record", next(rows))

[issue29202] Improve dict iteration

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I'm wondering why new dict implementation don't keep the array of items compact? Original Raymond's implementation did not preserve the order after deletions, but saved items in an array without gaps. This could simplify and speed up an iteration (no need

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I think this is a bug and it should be fixed in 3.6. I concur. Do you care to whip-up a patch (it is late here). -- ___ Python tracker

[issue29203] With PEP 468, the lru cache not longer needs to sort keyword args

2017-01-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think this is a bug and it should be fixed in 3.6. Currenly lru_cache breaks PEP 468 (Preserving Keyword Argument Order). >>> from functools import lru_cache >>> @lru_cache() ... def f(**kwargs): ... return list(kwargs.items()) ... >>> f(a=1, b=2)

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Paul Rubin writes: > seems to work, but is ugly. Maybe there's something better. def minabs2(xs): def z(): for x in xs: yield abs(x), x if x==0: break return min(z())[1] is the same thing but a little bit

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Paul Rubin writes: > Doesn't look that way to me: > >>> minabs([5,3,1,2,4]) > 1 There's a different problem though: >>> minabs([1,2,3,0]) 1 I think Python's version of iterators is actually buggy and at least the first element of the rest of the

  1   2   >