[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur with the others. This is unnecessary feature creep that doesn't make sense for typical use cases. -- nosy: +rhettinger resolution: -> rejected stage: -> resolved status: open -> closed ___ Python

Re: Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Irv Kalb
[ Sorry, forgot the important stuff! ] What you want to do is tricky because your data structure is difficult to deal with. My guess is that it has to do with a misconception about how a Python dictionary works. Yes, it is a series of key/value pairs, but not the way you have it. It looks

Re: Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Irv Kalb
> On Apr 8, 2017, at 5:55 PM, Kenton Brede wrote: > > This is an example of the data I'm working with. The key/value pairs may > come in any order. There are some keys like the 'Resource_group_id' key and > the 'Name' key which will always be present, but other lists may have

[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-08 Thread Dan Snider
Dan Snider added the comment: Just wanted to add that I found this when I was trying to find a way to decorate all methods in a class without using a metaclass or modifying __getattr__. Using Josh's workaround, here's a simple demonstration that (at least at first glance) prints a message

Re: Python and the need for speed

2017-04-08 Thread Chris Angelico
On Sun, Apr 9, 2017 at 10:20 AM, wrote: > I've an idea that http://www.mos6581.org/python_need_for_speed is a week late > for April Fool's but just in case I'm sure that some of you may wish to > comment. > >From that page: > Other candidates for banishment from

Re: Python and the need for speed

2017-04-08 Thread Thomas Nyberg
On 04/08/2017 05:20 PM, breamore...@gmail.com wrote: > I've an idea that http://www.mos6581.org/python_need_for_speed is a week late > for April Fool's but just in case I'm sure that some of you may wish to > comment. > > Kindest regards. > > Mark Lawrence. > Regarding your restricted subset

Need help with getting Key, Value out of dicts in lists

2017-04-08 Thread Kenton Brede
This is an example of the data I'm working with. The key/value pairs may come in any order. There are some keys like the 'Resource_group_id' key and the 'Name' key which will always be present, but other lists may have unique keys. alist = [[{u'Value': 'shibboleth-prd', u'Key': 'Name'},

Python and the need for speed

2017-04-08 Thread breamoreboy
I've an idea that http://www.mos6581.org/python_need_for_speed is a week late for April Fool's but just in case I'm sure that some of you may wish to comment. Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list

Re: read in a list in a file to list

2017-04-08 Thread Rick Johnson
@John General debugging methodology dictates that when your output does not match your expectation, you must never assume anything. Here you made the fatal mistake of assuming that: (1) files are stored as list objects, or (2) Python automatically converts file data to list objects, or (3) that

[issue23674] super() documentation isn't very clear

2017-04-08 Thread Martin Panter
Martin Panter added the comment: The magical no-argument call could also be clarified: 8. Define in the main text what happens when you omit the first argument (the subclass) to “super”. At the moment, I think the reader could infer that it is the method’s class, but this is only hinted by

[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-08 Thread Martin Panter
Martin Panter added the comment: In Issue 23674, I posted a patch that changes to consistent parameter names (subclass, self). The exception message would avoid “type”, becoming super(subclass, self): self must be an instance or subtype of subclass -- nosy: +martin.panter

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-04-08 Thread Mariatta Wijaya
Changes by Mariatta Wijaya : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue26860] Make os.walk and os.fwalk yield namedtuple instead of tuple

2017-04-08 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Should we have concerns about performances? Accessing a namedtuple value is almost 4x times slower compared to a plain tuple [1] and os.walk() may iterate hundreds of times.

[issue30008] OpenSSL 1.1.0 deprecated functions

2017-04-08 Thread Mike Gilbert
Mike Gilbert added the comment: Thanks for the reply. OpenSSL 1.1.0 added functions to control the SSL/TLS version used by SSL contexts created using TLS_method(). You might consider updating the code for existing Python branches to use these functions. SSL_CTX_set_min_proto_version

Re: read in a list in a file to list

2017-04-08 Thread boB Stepp
On Sat, Apr 8, 2017 at 3:21 PM, wrote: > On Saturday, April 8, 2017 at 7:32:52 PM UTC+1, john polo wrote: >> Hi, >> >> I am using Python 3.6 on Windows 7. >> >> I have a file called apefile.txt. apefile.txt's contents are: >> >> apes = "Home sapiens", "Pan troglodytes",

Re: read in a list in a file to list

2017-04-08 Thread breamoreboy
On Saturday, April 8, 2017 at 7:32:52 PM UTC+1, john polo wrote: > Hi, > > I am using Python 3.6 on Windows 7. > > I have a file called apefile.txt. apefile.txt's contents are: > > apes = "Home sapiens", "Pan troglodytes", "Gorilla gorilla" > > I have a script: > > apefile =

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I vote -1 too. 1. As was said, this doesn't work with all attribute names. 2. This adds circular dependency between operator and collections modules. 3. This increases memory consumption and startup time for small programs that don't use the collections

[issue30008] OpenSSL 1.1.0 deprecated functions

2017-04-08 Thread Christian Heimes
Christian Heimes added the comment: Thanks for your report. Python is going to require legacy functions like TLSv1_method() for a while. They are required to provide constants like PROTOCOL_TLSv1. I have deprecated these constants in 3.6 and they will be removed in 3.8. In the mean time

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Christian Heimes
Christian Heimes added the comment: I'm with RDM and vote -1, too. A namedtuple is a bit more costly than a normal tuple. That's especially try for dynamic attrgetter() that are defined ad-hoc, e.g. as key function for sorted(). The creation of type classes doesn't come for free. --

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread R. David Murray
R. David Murray added the comment: This is a clever idea, but I vote -1 for this proposal. I think it makes attrgetter more complex for little purpose. The fact that only some attribute names work and the others get mangled makes the API very ugly and not, IMO, desirable. Finally, if you

read in a list in a file to list

2017-04-08 Thread john polo
Hi, I am using Python 3.6 on Windows 7. I have a file called apefile.txt. apefile.txt's contents are: apes = "Home sapiens", "Pan troglodytes", "Gorilla gorilla" I have a script: apefile = open("apefile.txt") apelist = apefile.read() for ape in apelist: print("one of the apes is " +

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-08 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: For the sake of experiment I'm attaching a toy echo server which uses modify() to switch between EVENT_READ and EVENT_WRITE. Without patch I get 35000 req/sec, with patch around 39000 req/sec (11.4% faster). To be entirely honest a smarter echo server would

[issue30014] Speedup DefaultSelectors.modify() by 2x

2017-04-08 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : Added file: http://bugs.python.org/file46793/echo_client.py ___ Python tracker ___

[issue29957] unnecessary LBYL for key contained in defaultdict, lib2to3/btm_matcher

2017-04-08 Thread Jim Fasarakis-Hilliard
Jim Fasarakis-Hilliard added the comment: bump to close issue now that PR was merged -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___

[issue29963] Remove obsolete declaration PyTokenizer_RestoreEncoding in tokenizer.h

2017-04-08 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue29944] Argumentless super() fails in classes constructed with type()

2017-04-08 Thread Jim Fasarakis-Hilliard
Changes by Jim Fasarakis-Hilliard : -- nosy: +Jim Fasarakis-Hilliard ___ Python tracker ___

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Isaac Morland
Isaac Morland added the comment: What are the "other issues"? As to the issue you raise here, that's why I use rename=True. First create a type with an underscore attribute: >>> t = namedtuple ('t', ['a', '1234'], rename=True) (just an easy way of creating such a type; used of namedtuple

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Josh Rosenberg
Josh Rosenberg added the comment: Aside from other issues, namedtuples can't have fields beginning with underscores, attrgetter can get attributes beginning with underscores (and dotted attributes for that matter). There isn't going to be an obvious or intuitive mapping to apply here.

[issue19225] lack of PyExc_BufferError doc

2017-04-08 Thread KINEBUCHI Tomohiko
KINEBUCHI Tomohiko added the comment: Oh, I have overlooked these sentences. I will create an additional pull request to remove duplication. -- ___ Python tracker

[issue29725] sqlite3.Cursor doesn't properly document "arraysize"

2017-04-08 Thread Berker Peksag
Berker Peksag added the comment: > row_factory seems to be another parameter that can be set in the Cursor > object. > https://github.com/python/cpython/blob/master/Modules/_sqlite/cursor.c#L65 > > This can addressed in a different issue/ pr. Like I already said in msg290943,

[issue16572] Bad multi-inheritance support in some libs like threading or multiprocessing

2017-04-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: Multi-inheritance is tricky to get right, both for the class being extended and the class extending it. The APIs mentioned here were never designed for multiple inheritance and aren't supposed to support it. Your use case would probably be better served by

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Isaac Morland
Isaac Morland added the comment: I've attached a file which illustrates what I'm proposing to happen with the examples from the help. Note that attrgetter (attr) is not affected, only attrgetter (*attrs) for more than one attribute. The idea is that tuples resulting from attrgetter

[issue16572] Bad multi-inheritance support in some libs like threading or multiprocessing

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> rhettinger ___ Python tracker ___

[issue30006] Deadlocks in `concurrent.futures.ProcessPoolExecutor`

2017-04-08 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +bquinlan, davin, pitrou stage: -> patch review ___ Python tracker ___

[issue30022] Get rid of using EnvironmentError and IOError

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1203 ___ Python tracker ___ ___

[issue30022] Get rid of using EnvironmentError and IOError

2017-04-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: EnvironmentError and IOError now are aliases to OSError. But some code still use them. Proposed patch replaces all uses of EnvironmentError and IOError (except tests and scripts) with OSError. This will make the code cleaner and more uniform. --

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 1049 and PR 1050 restore ABI compatibility in 3.5 and 2.7. Unfortunately this restores the original bug with using PySlice_GetIndicesEx in third-party code (but CPython core and standard extensions no longer use PySlice_GetIndicesEx). Can we consider

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1202 ___ Python tracker ___ ___

[issue29943] PySlice_GetIndicesEx change broke ABI in 3.5 and 3.6 branches

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1201 ___ Python tracker ___ ___

Re: Elastic Search

2017-04-08 Thread Paul Rubin
Steve D'Aprano writes: > What's elastic search? > And what does this have to do with Python? https://www.elastic.co/ (formerly elasticsearch.org). It's a Lucene-based distributed search engine, something like Solr if you're used to that. It has Python client

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 by Serhiy Storchaka in branch 'master': Expand the PySlice_GetIndicesEx macro. (#1023) https://github.com/python/cpython/commit/b879fe82e7e5c3f7673c9a7fa4aad42bd05445d8 New changeset

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset e41390aca51e4e3eb455cf3b70f5d656a2814db9 by Serhiy Storchaka in branch '2.7': bpo-27867: Expand the PySlice_GetIndicesEx macro. (#1023) (#1046) https://github.com/python/cpython/commit/e41390aca51e4e3eb455cf3b70f5d656a2814db9 --

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset e63f8f293a96ceebf06de15b4e1c97dbbff0f6a8 by Serhiy Storchaka in branch '3.5': bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1043)

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset af685f9050416da8050e0ec11a8dff9afd4130e7 by Serhiy Storchaka in branch '3.6': bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) (#1042)

[issue30021] Add examples for re.escape()

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1200 ___ Python tracker ___ ___

[issue30021] Add examples for re.escape()

2017-04-08 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Proposed patch adds examples of using re.escape(). See also issue29995. -- assignee: docs@python components: Documentation, Regular Expressions messages: 291326 nosy: docs@python, ezio.melotti, mrabarnett, serhiy.storchaka priority: normal

[issue30012] gzip.open(filename, "rt") fails on Python 2.7.11 on win32, invalid mode rtb

2017-04-08 Thread Peter
Peter added the comment: OK, thanks. Given this is regarded as an enhancement rather than a bug fix, I understand the choice not to change this in Python 2.7. -- ___ Python tracker

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1198 ___ Python tracker ___ ___

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1197 ___ Python tracker ___ ___

[issue27867] various issues due to misuse of PySlice_GetIndicesEx

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1199 ___ Python tracker ___ ___

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1196 ___ Python tracker ___ ___

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1195 ___ Python tracker ___ ___

[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue29998] Pickling and copying ImportError doesn't preserve name and path

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b785396ab451b0c9d6ae9ee5a9e56c810209a6cb by Serhiy Storchaka in branch 'master': bpo-29998: Pickling and copying ImportError now preserves name and path (#1010) https://github.com/python/cpython/commit/b785396ab451b0c9d6ae9ee5a9e56c810209a6cb

[issue29914] Incorrect signatures of object.__reduce__() and object.__reduce_ex__()

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9 by Serhiy Storchaka in branch 'master': bpo-29914: Fix default implementations of __reduce__ and __reduce_ex__(). (#843) https://github.com/python/cpython/commit/205e00c5cfd495a4dc6dae8e8fa0fb828fb3dca9

[issue29956] math.exp documentation is misleading

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Not always. For example for x = 0 both methods give the same exact result. -- ___ Python tracker ___

[issue23894] lib2to3 doesn't recognize rb'...' and f'...' in Python 3.6

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Should this issue be closed now? -- ___ Python tracker ___ ___

[issue30020] Make attrgetter use namedtuple

2017-04-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Before writing a patch that may be rejected, can you explain in detail what change you propose? Example(s) will be good. For example: py> from operator import attrgetter py> f = attrgetter('keys') py> f({}) I don't see a tuple here, so what (if anything)

[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-08 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1194 ___ Python tracker ___ ___

[issue30017] zlib.error: Error -2 while flushing: inconsistent stream state

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I agree, that close() should be an idempotent operation. Proposed patch fixes this. -- assignee: -> serhiy.storchaka components: +Library (Lib) stage: needs patch -> patch review versions: +Python 3.7 ___ Python

[issue19225] lack of PyExc_BufferError doc

2017-04-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 7f85947106aff5b1f166a57f644f987db4d38bf0 by Serhiy Storchaka (cocoatomo) in branch '2.7': [2.7] bpo-19225: Lack of c api exceptions doc (#964) https://github.com/python/cpython/commit/7f85947106aff5b1f166a57f644f987db4d38bf0 --