[issue26491] Defer DECREFs until enum object is in a consistent state for re-entrancy

2016-03-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: serhiy.storchaka -> ___ Python tracker ___

[issue25652] collections.UserString.__rmod__() raises NameError

2016-03-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: serhiy.storchaka -> ___ Python tracker ___

[issue15216] Support setting the encoding on a text stream after creation

2016-03-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: quad, please don't change issue attributes to unrelated values. -- type: security -> enhancement versions: +Python 3.6 ___ Python tracker

[issue15216] Support setting the encoding on a text stream after creation

2016-03-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- components: -2to3 (2.x to 3.x conversion tool) ___ Python tracker ___

[issue15216] Support setting the encoding on a text stream after creation

2016-03-11 Thread Kwamenichols
Changes by Kwamenichols : -- components: +2to3 (2.x to 3.x conversion tool) hgrepos: +334 versions: -Python 3.6 ___ Python tracker

[issue15216] Support setting the encoding on a text stream after creation

2016-03-11 Thread Kwamenichols
Changes by Kwamenichols : -- nosy: +quad type: enhancement -> security ___ Python tracker ___

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset e54224e8d6a9 by Victor Stinner in branch 'default': Revert change 291d47954618 https://hg.python.org/cpython/rev/e54224e8d6a9 -- ___ Python tracker

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: Elena's issue13305.diff: "Zero padding can be forced on some platforms by using e.g. ``%4Y``" Sorry, I still doesn't understand the change. %4Y doesn't work with strptime() and it only work with strftime() on very few platforms. Can you explain when %4Y

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: >> About Elena Oat's patch issue13305.diff: I'm not sure that >> strftime("%4Y") works on all platforms > It doesn't, that's what the patch is trying to document. Oh. I confirm: %4Y gives "4Y" for any year on FreeBSD and Mac OS X, it raises

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-11 Thread Marko Rauhamaa
Chris Angelico : > Definitely agree with this. Having a way to declare that a name is > "truly constant" would be extremely handy; I don't think it would be all that handy. I'm afraid all this type hinting will turn Python into a poor man's Java. > Maybe, but I honestly don't

Re: Descriptors vs Property

2016-03-11 Thread Ian Kelly
On Fri, Mar 11, 2016 at 11:24 PM, Veek. M wrote: > Ian Kelly wrote: > >> On Fri, Mar 11, 2016 at 10:59 PM, Veek. M wrote: >>> Also, what's this bit: >>> self.default = default if default else type() >> >> If the default parameter has a truthy value, it

Re: Descriptors vs Property

2016-03-11 Thread Chris Angelico
On Sat, Mar 12, 2016 at 5:24 PM, Veek. M wrote: >> Also, what's this bit: >> self.default = default if default else type() > But type() just gives me: > TypeError: type() takes 1 or 3 arguments > on py2,3 Check out the context of the original line of code and see what it's

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Ezio Melotti
Ezio Melotti added the comment: > About Elena Oat's patch issue13305.diff: I'm not sure that > strftime("%4Y") works on all platforms It doesn't, that's what the patch is trying to document. AFAICT it works on my Linux (but not on yours), it gives '4Y' on Mac, and raises an error on Windows.

[issue17605] mingw-meta: build interpeter core

2016-03-11 Thread Mark Lawrence
Changes by Mark Lawrence : -- nosy: -BreamoreBoy ___ Python tracker ___ ___

Re: Descriptors vs Property

2016-03-11 Thread Veek. M
Ian Kelly wrote: > On Fri, Mar 11, 2016 at 10:59 PM, Veek. M wrote: >> A property uses the @property decorator and has @foo.setter >> @foo.deleter. >> >> A descriptor follows the descriptor protocol and implements the >> __get__ __set__ __delete__ methods. >> >> But they

[issue26519] Cython doesn't work anymore on Python 3.6

2016-03-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Stefan, could you please check that this issue is fixed and there are no other cases of pickling or copying unpickleable classes? -- ___ Python tracker

Re: Descriptors vs Property

2016-03-11 Thread Veek. M
Veek. M wrote: > A property uses the @property decorator and has @foo.setter > @foo.deleter. > > A descriptor follows the descriptor protocol and implements the > __get__ __set__ __delete__ methods. > > But they both do essentially the same thing, allow us to do: > foo = 10 > del foo > x = foo

Re: Descriptors vs Property

2016-03-11 Thread Ian Kelly
On Fri, Mar 11, 2016 at 10:59 PM, Veek. M wrote: > A property uses the @property decorator and has @foo.setter > @foo.deleter. > > A descriptor follows the descriptor protocol and implements the __get__ > __set__ __delete__ methods. > > But they both do essentially the same

Re: Descriptors vs Property

2016-03-11 Thread Chris Angelico
On Sat, Mar 12, 2016 at 4:59 PM, Veek. M wrote: > A property uses the @property decorator and has @foo.setter > @foo.deleter. > > A descriptor follows the descriptor protocol and implements the __get__ > __set__ __delete__ methods. > > But they both do essentially the same

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-11 Thread Steven D'Aprano
On Sat, 12 Mar 2016 12:10 pm, Dennis Lee Bieber wrote: > On Fri, 11 Mar 2016 22:24:45 +, BartC declaimed the > following: > >>On 11/03/2016 21:59, Mark Lawrence wrote: >>> On 11/03/2016 18:57, BartC wrote: >> >>> def test(): >>> s="" >>> for i in range(1000):

Descriptors vs Property

2016-03-11 Thread Veek. M
A property uses the @property decorator and has @foo.setter @foo.deleter. A descriptor follows the descriptor protocol and implements the __get__ __set__ __delete__ methods. But they both do essentially the same thing, allow us to do: foo = 10 del foo x = foo So why do we have two ways of

[issue22625] When cross-compiling, don’t try to execute binaries

2016-03-11 Thread Martin Panter
Martin Panter added the comment: In I suggested adding some makefile settings to manually override the pgen and _frozen_importlib programs. I imagine the changes would look something like cross-override.patch. Can someone

[issue26314] interned strings are stored in a dict, a set would use less memory

2016-03-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Dicts are hard optimized for string keys due to using them for globals and attributes lookup. Sets are optimized too, but rather for accident. We can be sure that dicts will be always optimized, but set optimization can be eliminated for the sake of

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-11 Thread Rustom Mody
On Saturday, March 12, 2016 at 7:50:43 AM UTC+5:30, Chris Angelico wrote: > On Sat, Mar 12, 2016 at 12:16 PM, BartC wrote: > > You'd be surprised how much any kind of program relies on adhoc integer > > operations. It doesn't need to work with large int arrays for them to be > > important. (Look

Psycopg2 to create a record using a FK

2016-03-11 Thread Aaron Christensen
Hello, I am running the following versions of software: Python 3.5 psycopg2==2.6.1 Postgres 9.4.5 I have 2 tables. Table User has UserId (serial PK), LastName, FirstName, Gender, DateOfBirth, and DateEnrolled. Table UserProfile has UserProfileId (serial, PK), UserId (FK), DateEntered,

Re: Encapsulation in Python

2016-03-11 Thread Rick Johnson
On Friday, March 11, 2016 at 9:48:22 AM UTC-6, Ian wrote: > On Thu, Mar 10, 2016 at 5:45 PM, Rick Johnson wrote: > > Many times, i would have preferred to define my module space > > across multiple files, multiple files that could share state > > without resorting to the yoga-style "import

[issue26511] Add link to id() built-in in comparison operator documentation for "is"

2016-03-11 Thread Martin Panter
Martin Panter added the comment: Please don’t use nested brackets like that in English text. Try to rewrite the sentence without brackets (e.g. use a comma or say “This is equivalent to”) [or use a different kind of bracket if you really must (to make the nesting clearer)]. -- nosy:

Re: Encapsulation in Python

2016-03-11 Thread Rick Johnson
On Friday, March 11, 2016 at 9:48:22 AM UTC-6, Ian wrote: > On Thu, Mar 10, 2016 at 5:45 PM, Rick Johnson > The honorable Rick Johnson wrote: > > Many times, i would have preferred to define my module space > > across multiple files, multiple files that could share state > > without resorting to

[issue17592] mingw: configure MACHDEP and platform for build

2016-03-11 Thread Martin Panter
Martin Panter added the comment: Here is a modified patch fixing a couple of the spelling & style problems. I moved the comment introducing the ac_sys_ variables up to before the code that sets them. I rearranged the logic for _PYTHON_HOST_PLATFORM so it is clear that $host_os overrides

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-11 Thread Chris Angelico
On Sat, Mar 12, 2016 at 12:16 PM, BartC wrote: > On 11/03/2016 21:36, Chris Angelico wrote: >> >> constants, and can then perform all the other optimizations you >> describe (since functions are themselves immutable, all you need is an >> identity check on the function object

[issue26535] Minor typo in the docs for struct.unpack

2016-03-11 Thread Martin Panter
Martin Panter added the comment: The patch looks good to me, though it should be applied to all three unpack functions and Struct methods, and the doc strings (struct.unpack.__doc__ etc). An alternative wording is already used for struct.iter_unpack(): “the buffer’s size in bytes”. Maybe that

[issue26530] tracemalloc: add C API to manually track/untrack memory allocations

2016-03-11 Thread Nathaniel Smith
Nathaniel Smith added the comment: > Note: I don't understand what are domain, tag (address of the memory block?) > or quantity (size of the memory block?). Yes, the idea is basically the same as now, except with an extra const char * specifying the "domain", so that one could keep separate

[issue17590] mingw: translate gcc internal defines to python platform specific defines

2016-03-11 Thread Martin Panter
Martin Panter added the comment: Here is a possible alternative patch that moves MS_WINDOWS etc from PC/pyconfig.h to "pyport.h". Not tested with standard Windows build. -- components: -Cross-Build Added file: http://bugs.python.org/file42141/MS_WINDOWS-move.patch

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-11 Thread BartC
On 11/03/2016 21:36, Chris Angelico wrote: On Sat, Mar 12, 2016 at 5:57 AM, BartC wrote: Functions are dynamic. That is, you don't know the F in F() is actually a function, even if it was defined a few lines previously, because it could have been rebound to something else.

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-11 Thread Michael Torrie
On 03/11/2016 03:24 PM, BartC wrote: > On 11/03/2016 21:59, Mark Lawrence wrote: >> On 11/03/2016 18:57, BartC wrote: > >> def test(): >> s="" >> for i in range(1000): >> s+="*" >> print (len(s)) >> >> test() > >> The minor snag that you might like to correct with

Re: Encapsulation in Python

2016-03-11 Thread Rick Johnson
(NOTE: My apologies to the group if this same message was sent twice. From my end, it appears to have been lost, so i'm sending again. Thanks) On Thursday, March 10, 2016 at 1:36:48 PM UTC-6, Mark Lawrence wrote: > On 10/03/2016 14:57, Dan Strohl via Python-list wrote: > >> I've been studying

[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2016-03-11 Thread Martin Panter
Martin Panter added the comment: I tend to agree with the comment at . Find_library() is documented as emulating a build-time linker, not run-time. Build-time linking ignores LD_LIBRARY_PATH. Maybe it would make more sense to pass in an optional

[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Berker Peksag
Changes by Berker Peksag : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___

[issue26545] os.walk is limited by python's recursion limit

2016-03-11 Thread Thomas Waldmann
Thomas Waldmann added the comment: Note: similar issues can be seen in other stdlib recursive filesystem-related functions also. -- ___ Python tracker

[issue26545] os.walk is limited by python's recursion limit

2016-03-11 Thread Thomas Waldmann
New submission from Thomas Waldmann: os.walk calls itself recursively and that limits the directory depth it can "walk" into. On Linux, one can create directory hierarchies deeper than that. For some more details see there: https://github.com/borgbackup/borg/issues/380 --

Re: Encapsulation in Python

2016-03-11 Thread Gregory Ewing
Rick Johnson wrote: I have witnessed the mayhem that occurs when a language does not mandate module encapsulation (Ruby, i'm looking directly at you), and while i agree with the Python designers that modules must *ALWAYS* be mandatory, i am not convinced that module space should be so

Re: Encapsulation in Python

2016-03-11 Thread Rick Johnson
On Friday, March 11, 2016 at 3:28:40 AM UTC-6, Steven D'Aprano wrote: > That's one theory. Another theory is: no they shouldn't, all attributes > should be public. That most accurately models actual physical objects and > maximizes the usefulness of the attribute. > > People over-use private,

[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread Berker Peksag
Berker Peksag added the comment: Thanks Victor. -- resolution: -> fixed status: open -> closed ___ Python tracker ___

[issue21910] File protocol should document if writelines must handle generators sensibly

2016-03-11 Thread Martin Panter
Changes by Martin Panter : -- stage: -> needs patch ___ Python tracker ___ ___

Re: Where is Python 3.6 installer for Win64?

2016-03-11 Thread Terry Reedy
On 3/11/2016 2:37 PM, Tim Golden wrote: On 11/03/2016 19:24, Giga Image wrote: On Soruceforge, Python for Windows Extension, I noticed that they already haven a installer for Python 3.6. Where do I find Python 3.6 installer for Win64. I couldn't find it on Python.org/download page. The

[issue26544] platform.libc_ver() returns incorrect version number

2016-03-11 Thread Ned Deily
Changes by Ned Deily : -- nosy: +lemburg ___ Python tracker ___ ___ Python-bugs-list mailing

[issue26544] platform.libc_ver() returns incorrect version number

2016-03-11 Thread Thomas Waldmann
New submission from Thomas Waldmann: platform.libc_ver() is trivially broken as it uses string comparison internally to determine the maximum libc version number (which is obviously broken as "2.9" > "2.10"). -- components: Library (Lib) messages: 261624 nosy: Thomas.Waldmann

[issue26535] Minor typo in the docs for struct.unpack

2016-03-11 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +terry.reedy ___ Python tracker ___ ___

[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

2016-03-11 Thread Martin Panter
Martin Panter added the comment: To add a second response you would just concatenate it to the existing response. (Your existing test already uses FakeSocket.) The FakeSocket parameter just represents data that would be sent from the server. So: body = ( b"HTTP/1.1 200 OK\r\n"

[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Amit Saha
Amit Saha added the comment: Thank you Victor. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

Re: Perl to Python again

2016-03-11 Thread Fillmore
On 3/11/2016 7:12 PM, Martin A. Brown wrote: Aside from your csv question today, many of your questions could be answered by reading through the manual documenting the standard datatypes (note, I am assuming you are using Python 3). are you accusing me of being lazy? if that's your

[issue26525] Documentation of ord(c) easy to misread

2016-03-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: The easily misread "ord('ν')" could be expanded to "ord('ν') (Greek nu)" but I agree that "ord('€') (Euro sign)" would be either better for a global doc. (And the return is 8364.) If no objection (Benjamin? Nick?), I am willing to do it for 3.5/6 There is

Re: Perl to Python again

2016-03-11 Thread Martin A. Brown
Good afternoon Fillmore, > So, now I need to split a string in a way that the first element > goes into a string and the others in a list: > > while($line = ) { > >my ($s,@values) = split /\t/,$line; > > I am trying with: > > for line in sys.stdin: >s,values = line.strip().split("\t")

Re: Perl to Python again

2016-03-11 Thread sohcahtoa82
On Friday, March 11, 2016 at 3:42:36 PM UTC-8, Fillmore wrote: > So, now I need to split a string in a way that the first element goes > into a string and the others in a list: > > while($line = ) { > > my ($s,@values) = split /\t/,$line; > > I am trying with: > > for line in sys.stdin:

[issue26511] Add link to id() built-in in comparison operator documentation for "is"

2016-03-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: There is not 'integer caching in Python'. This is strictly an implementation feature of CPython, and any other implementation that does similarly. "or id(x) == id(y)" should be "(id(x) == id(y))" as the addition is an alternate wording, not an alternate

Re: Encapsulation in Python

2016-03-11 Thread Rick Johnson
On Thursday, March 10, 2016 at 1:36:48 PM UTC-6, Mark Lawrence wrote: > On 10/03/2016 14:57, Dan Strohl via Python-list wrote: > >> I've been studying Object Oriented Theory using Java. Theoretically, all > >> attributes should be private, meaning no one except the methods itself can > >> access

[issue26500] Document of new star unpacking is missing.

2016-03-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: #19024 was about adding a general section on the various uses of '*'. This was before the new * unpacking generalizations. It was closed because the then existing uses *are* documented and are indexed in the first, Symbols, section of the index. There are

Re: Hello

2016-03-11 Thread Steven D'Aprano
On Sat, 12 Mar 2016 09:53 am, Larry Martell wrote: > Many years ago (c. 1985) I was at a job interview and the interviewer > asked me what the first thing I would do when I am presented with a new > problem that I had to code up. I gave all sorts of answers like 'do a top > down analysis of the

[issue26512] Vocabulary: Using "integral" in library/stdtypes.html

2016-03-11 Thread Martin Panter
Martin Panter added the comment: I have looked at PEP 3141, the history of the documentation in question, and the documentation of the functions in the “math” module. It seems that trunc(), floor() and ceil() were all intended to return a numbers.Integral type, but then PEP 3141’s floor() and

Perl to Python again

2016-03-11 Thread Fillmore
So, now I need to split a string in a way that the first element goes into a string and the others in a list: while($line = ) { my ($s,@values) = split /\t/,$line; I am trying with: for line in sys.stdin: s,values = line.strip().split("\t") print(s) but no luck: ValueError:

Re: argparse

2016-03-11 Thread Ian Kelly
On Fri, Mar 11, 2016 at 4:18 PM, Fillmore wrote: > > Playing with ArgumentParser. I can't find a way to override the -h and > --help options so that it provides my custom help message. > > -h, --help show this help message and exit > > Here is what I am

[issue24136] document PEP 448: unpacking generalization

2016-03-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: It is now 10 months and 2 releases since the rather large code patch. Documenting the extensive changes does not seem easy to me ;-). Certainly, a beginner needs feedback. -- nosy: +terry.reedy ___ Python tracker

[issue2292] Missing *-unpacking generalizations

2016-03-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: > the docs don't need to be committed in time for beta 1. 10 months and 2 releases after the code patch, the doc patches in #24136 are incomplete (I believe), uncommitted, untouched since July, and forgotten about. The issue needs more help. --

Re: argparse

2016-03-11 Thread Fillmore
On 3/11/2016 6:26 PM, Larry Martell wrote: am I missing something obvious? https://docs.python.org/2/library/argparse.html#usage you rock! -- https://mail.python.org/mailman/listinfo/python-list

Re: argparse

2016-03-11 Thread Larry Martell
On Fri, Mar 11, 2016 at 6:18 PM, Fillmore wrote: > > > Playing with ArgumentParser. I can't find a way to override the -h and --help > options so that it provides my custom help message. > > -h, --help show this help message and exit > > Here is what I am

Re: argparse

2016-03-11 Thread Bob Gailer
On Mar 11, 2016 6:20 PM, "Fillmore" wrote: > > > Playing with ArgumentParser. I can't find a way to override the -h and --help options so that it provides my custom help message. > > -h, --help show this help message and exit > > Here is what I am trying: >

[issue26543] imaplib noop Debug

2016-03-11 Thread Stephen Evans
New submission from Stephen Evans: With the imaplib.Debug=3 (or greater) imaplib.noop() will crash if there are any untagged responses present. The _dump_ur() function has not been converted to expect bytes in the lambda variable x[1]. An abbreviate example of the 'dict' parameter would be:

argparse

2016-03-11 Thread Fillmore
Playing with ArgumentParser. I can't find a way to override the -h and --help options so that it provides my custom help message. -h, --help show this help message and exit Here is what I am trying: parser = argparse.ArgumentParser("csresolver.py",add_help=False)

[issue26314] interned strings are stored in a dict, a set would use less memory

2016-03-11 Thread Gregory P. Smith
Gregory P. Smith added the comment: updated patch: Don't Py_CLEAR the dummy sentinel value in PySet_Fini. The interned set uses it. Otherwise it causes problems when re-initializing after a Fini as happens in processes the setup and tear down an embedded interpreter multiple times.

Re: Hello

2016-03-11 Thread Larry Martell
On Fri, Mar 11, 2016 at 4:49 AM, Steven D'Aprano wrote: > On Fri, 11 Mar 2016 02:28 pm, rubengoods...@yahoo.com wrote: > > > I am having trouble installing the Python software. > > Make sure your computer is turned on. I can't tell you how many times I've > tried to install

[issue26509] spurious ConnectionAbortedError logged on Windows

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: > Your patch seems to miss the ``_fatal_error`` method in > ``proactor_events.py`` (which is actually where the bug happens in my > application - it's using ``ProactorEventLoop``). Oops :-) What a shame. It's now fixed. Note:

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-11 Thread Mark Lawrence
On 11/03/2016 22:24, BartC wrote: On 11/03/2016 21:59, Mark Lawrence wrote: On 11/03/2016 18:57, BartC wrote: def test(): s="" for i in range(1000): s+="*" print (len(s)) test() The minor snag that you might like to correct with your microbenchmark, which any

Re: hasattr() or "x in y"?

2016-03-11 Thread Grant Edwards
On 2016-03-11, Charles T. Smith wrote: > On Fri, 11 Mar 2016 22:00:41 +, Grant Edwards wrote: > >> Since they behave differently, perhaps the question ought to be "which >> does what you want to do?" > > For parsed msgs, I had this: > > elif hasattr

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-11 Thread BartC
On 11/03/2016 21:59, Mark Lawrence wrote: On 11/03/2016 18:57, BartC wrote: def test(): s="" for i in range(1000): s+="*" print (len(s)) test() The minor snag that you might like to correct with your microbenchmark, which any experienced Python programmer

Re: hasattr() or "x in y"?

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 22:00:41 +, Grant Edwards wrote: > Since they behave differently, perhaps the question ought to be "which > does what you want to do?" For parsed msgs, I had this: elif hasattr (msg.msgBody, 'request'): It occurred to me that this was less abstruse:

Re: hasattr() or "x in y"?

2016-03-11 Thread Mark Lawrence
On 11/03/2016 22:00, Grant Edwards wrote: On 2016-03-11, Charles T. Smith wrote: From the performance point of view, which is better: - hasattr() - x in y Dunno, is red an even or odd color? How many pancakes does it take to cover a doghouse? "x" in "asdf"

Re: hasattr() or "x in y"?

2016-03-11 Thread Grant Edwards
On 2016-03-11, Charles T. Smith wrote: > From the performance point of view, which is better: > - hasattr() > - x in y Dunno, is red an even or odd color? How many pancakes does it take to cover a doghouse? >>> "x" in "asdf" False >>> "x" in "xyz" True >>>

Re: hasattr() or "x in y"?

2016-03-11 Thread Mark Lawrence
On 11/03/2016 21:53, Charles T. Smith wrote: On Fri, 11 Mar 2016 21:44:27 +, Charles T. Smith wrote: From the performance point of view, which is better: - hasattr() - x in y TIA cts I just realized that "in" won't look back through the class hierarchy... that clearly makes them not

Re: hasattr() or "x in y"?

2016-03-11 Thread Chris Angelico
On Sat, Mar 12, 2016 at 8:53 AM, Charles T. Smith wrote: > On Fri, 11 Mar 2016 21:44:27 +, Charles T. Smith wrote: > >> From the performance point of view, which is better: - hasattr() >> - x in y >> >> TIA >> cts > > > I just realized that "in" won't look back

Re: hasattr() or "x in y"?

2016-03-11 Thread Charles T. Smith
On Fri, 11 Mar 2016 21:44:27 +, Charles T. Smith wrote: > From the performance point of view, which is better: - hasattr() > - x in y > > TIA > cts I just realized that "in" won't look back through the class hierarchy... that clearly makes them not interchangable, but given we're only

Re: Pyhon 2.x or 3.x, which is faster?

2016-03-11 Thread Mark Lawrence
On 11/03/2016 18:57, BartC wrote: Anyway, I've listed some of the stumbling blocks I think that Python has in making it bit faster: http://pastebin.com/WfUfK3bc The String Append Benchmark This is a microbenchmark, but makes use of a technique I use extensively (creating a file for example

Re: hasattr() or "x in y"?

2016-03-11 Thread Chris Angelico
On Sat, Mar 12, 2016 at 8:44 AM, Charles T. Smith wrote: > From the performance point of view, which is better: > - hasattr() > - x in y > Mu. They do completely different things. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 64d45f3d0978 by Victor Stinner in branch '3.5': Issue #20589: Fix test_pathlib https://hg.python.org/cpython/rev/64d45f3d0978 -- ___ Python tracker

hasattr() or "x in y"?

2016-03-11 Thread Charles T. Smith
>From the performance point of view, which is better: - hasattr() - x in y TIA cts -- https://mail.python.org/mailman/listinfo/python-list

[issue26488] hashlib command line interface

2016-03-11 Thread Terry J. Reedy
Terry J. Reedy added the comment: This strikes me as a sensible addition. While I did not review the patch in detail, it seems cleanly written and is complete in having a new main() for the code, a new doc section, and a new unittest Test class. -- nosy: +terry.reedy stage: -> patch

[issue20589] pathlib.owner() and pathlib.group() raise ImportError on Windows

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: Tests fail... http://buildbot.python.org/all/builders/x86-64 Ubuntu 15.10 Skylake CPU 3.5/builds/276/ == ERROR: test_group (test.test_pathlib.PureWindowsPathTest)

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: acucci's patch doc.patch suggests to use format "%4Y". Problem: I tried it on Linux, and it looks like it doesn't work. >>> datetime.datetime.strptime("1980", "%Y") datetime.datetime(1980, 1, 1, 0, 0) >>> datetime.datetime.strptime("1980", "%4Y") Traceback

[issue26483] docs unclear on difference between str.isdigit() and str.isdecimal()

2016-03-11 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +terry.reedy versions: -Python 3.4 ___ Python tracker ___

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 291d47954618 by Victor Stinner in branch 'default': Always test datetime.strftime("%4Y") https://hg.python.org/cpython/rev/291d47954618 -- ___ Python tracker

The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-11 Thread Chris Angelico
On Sat, Mar 12, 2016 at 5:57 AM, BartC wrote: > Anyway, I've listed some of the stumbling blocks I think that Python has in > making it bit faster: http://pastebin.com/WfUfK3bc > Much easier to discuss text that's inline, so I'm taking this out of pastebin. > Functions are

[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: About Elena Oat's patch issue13305.diff: I'm not sure that strftime("%4Y") works on all platforms, so I enabled the test on strftime("%4Y"). I will check our buildbots. -- ___ Python tracker

Re: issue with CVS module

2016-03-11 Thread Fillmore
On 3/11/2016 2:41 PM, Fillmore wrote: I have a TSV file containing a few strings like this (double quotes are part of the string): A big thank you to everyone who helped with this and with other questions. My porting of one of my Perl scripts to Python is over now that the two scripts

Re: issue with CVS module

2016-03-11 Thread Fillmore
On 3/11/2016 4:15 PM, Mark Lawrence wrote: https://docs.python.org/3/library/csv.html#csv.Dialect.doublequote thanks, but my TSV is not using any particular dialect as far as I understand... Thank you, anyway -- https://mail.python.org/mailman/listinfo/python-list

Re: issue with CVS module

2016-03-11 Thread Fillmore
On 3/11/2016 4:14 PM, MRAB wrote: >>> import csv >>> s = '"Please preserve my doublequotes"\ttext1\ttext2' >>> reader = csv.reader([s], delimiter='\t', quotechar=None) >>> for row in reader: ... print(row[0]) ... "Please preserve my doublequotes" >>> This worked! thank you MRAB

[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset bd75f8d34f97 by Victor Stinner in branch 'default': Add Mock.assert_called() https://hg.python.org/cpython/rev/bd75f8d34f97 -- nosy: +python-dev ___ Python tracker

[issue26323] Add assert_called() and assert_called_once() methods for mock objects

2016-03-11 Thread STINNER Victor
STINNER Victor added the comment: > Yes, this can go in. Cool. I pushed the latest patch of Amit Saha. I just modified assert_call() doc to add "at least once". Thanks Amit for your contribution! -- ___ Python tracker

Re: issue with csv module (subject module name spelling correction, too)

2016-03-11 Thread Martin A. Brown
Good afternoon Fillmore, import csv s = '"Please preserve my doublequotes"\ttext1\ttext2' reader = csv.reader([s], delimiter='\t') > How do I instruct the reader to preserve my doublequotes? Change the quoting used by the dialect on the csv reader instance: reader =

[issue26542] Wrongly formatted doctest block in difflib documentation

2016-03-11 Thread Berker Peksag
Berker Peksag added the comment: Good catch, Dmitry. Thanks for the patch! -- nosy: +berker.peksag resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker

[issue26542] Wrongly formatted doctest block in difflib documentation

2016-03-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset ffd0603f5251 by Berker Peksag in branch '3.5': Issue #26542: Fix markup of code example in difflib documentation https://hg.python.org/cpython/rev/ffd0603f5251 New changeset 40d92c92eb6e by Berker Peksag in branch 'default': Issue #26542: Fix

Re: issue with CVS module

2016-03-11 Thread Mark Lawrence
On 11/03/2016 19:41, Fillmore wrote: I have a TSV file containing a few strings like this (double quotes are part of the string): '"pragma: CacheHandler=08616B7E907744E026C9F044250EA55844CCFD52"' After Python and the CVS module has read the file and re-printed the value, the string has

  1   2   3   >