Re: Python text file fetch specific part of line

2016-07-29 Thread Gordon Levi
c...@zip.com.au wrote: >On 28Jul2016 19:28, Gordon Levi wrote: >>Arshpreet Singh wrote: >>>I am writing Imdb scrapper, and getting available list of titles from IMDB >>>website which provide txt file in very raw format, Here is the one part of

Re: TypeError: '_TemporaryFileWrapper' object is not an iterator

2016-07-29 Thread Antoon Pardon
Below is a short program that illustrate the problem It works with python2, whether you use the -c option or not. It only works with python3 if you use the -c option. The problem seems to come from my expectation that a file is its own iterator and in python3 that is no longer true for a

Re: functools.partial [was Re: and on - topic and and off topic]

2016-07-29 Thread Matt Wheeler
On Fri, 29 Jul 2016, 09:20 Steven D'Aprano, wrote: > I'm not sure that partial is intended as an optimization. It may end up > saving time by avoiding evaluating arguments, but that's not why it exists. > It exists to enable the functional programming idiom of partial

[issue27577] Make implementation and doc of tuple and list more compliant

2016-07-29 Thread Xiang Zhang
Xiang Zhang added the comment: Nice to know your opinions. :) Adjust the patch to use Terry's sentence. -- components: +Documentation -Interpreter Core Added file: http://bugs.python.org/file43934/tuple_and_list_parameter_name_v2.patch ___ Python

[issue27639] UserList.__getitem__ doesn't account for slices

2016-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Take a look at the following code from UserList.py in Python2.7 to get an idea of how this was implemented previously: def __getslice__(self, i, j): i = max(i, 0); j = max(j, 0) return self.__class__(self.data[i:j]) def

[issue27639] UserList.__getitem__ doesn't account for slices

2016-07-29 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg271612 ___ Python tracker ___

[issue27577] Make implementation and doc of tuple and list more compliant

2016-07-29 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree with Raymond's comments. No 'note', and once in each doc. Perhaps 'for __ and __, the actual name of parameter 'iterable' is still 'sequence'. ('Still' would be appropriate if the functions predate iterables.) --

[issue27577] Make implementation and doc of tuple and list more compliant

2016-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Can you limit the doc change to just a single occurrence for list and tuple. I'm averse to filling docs with redundant, noisy notes over a very minor nuance that is more of a curiosity than an actual issue. Also, can you inline the text rather than using

[issue27397] email.message.Message.get_payload(decode=True) raises AssertionError that "should never happen"

2016-07-29 Thread Jami Lindh
Jami Lindh added the comment: It might also make sense to return the payload undecoded. The documentation for get_payload() function says: "[...] the payload will be decoded if this header’s value is quoted-printable or base64. If some other encoding is used, or Content-Transfer-Encoding

[issue27639] UserList.__getitem__ doesn't account for slices

2016-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: As far as I can tell, there has never been a need or request for UserList slice support in its 17 year history. And since the collections ABCs were added, this class has mostly fallen into disuse and probably doesn't warrant API expansion (the module only

functools.partial [was Re: and on - topic and and off topic]

2016-07-29 Thread Steven D'Aprano
On Fri, 29 Jul 2016 12:23 am, Sivan Greenberg wrote: > 1. When is the use of functools.partial beneficial? When can it be a > hindrance? Perhaps it can save on func argument evaluation time when > creating many invocations for asycn exec? I'm not sure that partial is intended as an optimization.

[issue27624] unclear documentation on Queue.qsize()

2016-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry Doug, I don't find any of the suggestions to be an improvement and I concur with David Murray that the docstring for qsize() isn't the place for a tutorial on race conditions and LBYL vs EAPF which are general threading topics rather than a queue

[issue27131] Unit test random shuffle

2016-07-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've just looked at the existing tests for random.shuffle() and found that they already cover this case and do a much more thorough job. The suggested patch doesn't add anything. Sorry, I'm going to close this one -- there isn't any problem being

<    1   2