Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Rustom Mody
On Thursday, July 21, 2016 at 11:05:28 AM UTC+5:30, Chris Angelico wrote: > On Thu, Jul 21, 2016 at 3:28 PM, Rustom Mody wrote: > > ε is spelt ⎕ct (Comparison Tolerance) > > And of course == is spelt = > > spelt is spelled spelled. Unless, of course, you mean the wheat variety. Love it! Though

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Rustom Mody
On Wednesday, July 20, 2016 at 8:29:25 PM UTC+5:30, Marko Rauhamaa wrote: > Chris Angelico : > > > On Wed, Jul 20, 2016 at 11:54 PM, Marko Rauhamaa wrote: > >> 2. Floating-point numbers are *imperfect approximations* of real > >> numbers. Even when real numbers are derived exactly, > >>

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 3:28 PM, Rustom Mody wrote: > ε is spelt ⎕ct (Comparison Tolerance) > And of course == is spelt = spelt is spelled spelled. Unless, of course, you mean the wheat variety. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

[issue27581] Fix overflow check in PySequence_Tuple

2016-07-20 Thread Xiang Zhang
New submission from Xiang Zhang: Overflow check in PySequence_Tuple relies on undefined behaviour, fix it. -- components: Interpreter Core files: overflow_check_in_PySequence_Tuple.patch keywords: patch messages: 270909 nosy: martin.panter, serhiy.storchaka, xiang.zhang priority: normal

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Rustom Mody
On Wednesday, July 20, 2016 at 11:13:05 AM UTC+5:30, Steven D'Aprano wrote: > On Tuesday 19 July 2016 14:58, Rustom Mody wrote: > > > So I again ask: You say «"Never compare floats for equality" is a pernicious > > myth» > > It is the word *never* which makes it superstition. If people said

[issue27580] CSV Null Byte Error

2016-07-20 Thread Bobby Ocean
New submission from Bobby Ocean: I think this has been asked before, but it has been awhile and I think needs to be re-addressed. Why doesn't the CSV module handle NULL bytes? Let me do some examples, ascii = [chr(n) for n in range(256)] #No errors print(ascii) #No errors

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-07-20 Thread Xiang Zhang
Xiang Zhang added the comment: Hi, Martin. I replied your last comment and your patch looks good to me except one test fails: [1/1] test_zlib test_abcdefghijklmnop (test.test_zlib.ChecksumTestCase) test issue1202 compliance: signed crc32, adler32 in 2.x ... ok test_adler32empty

[issue27575] dict viewkeys intersection slow for large dicts

2016-07-20 Thread David Su
David Su added the comment: Here are some tests that I ran: Using current naive viewkeys intersection: $ python -m timeit -n 100 -s "d = dict.fromkeys(xrange(1000), 0)" "d.viewkeys() & {0}" 100 loops, best of 3: 447 msec per loop Nearly half a second per iteration is unacceptably slow.

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Steven D'Aprano
On Wed, 20 Jul 2016 11:24 pm, alister wrote: > One of my biggest questions since the Brexit vote is can we g back to > using imperial weights & measures (please). I suppose you might as well -- there's no more empire, no more jobs or houses, and once the financial traders leave London there'll

[issue27575] dict viewkeys intersection slow for large dicts

2016-07-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, sets and dicts convert back and forth very efficiently (the hash values are reused and the collection is presized with just a single memory allocation). Also, the sets and dicts have shared pointers to the underlying data (which is often much bigger

[issue26662] configure/Makefile doesn't check if "python" command works, needed to build Objects/typeslots.inc

2016-07-20 Thread Martin Panter
Martin Panter added the comment: The new patch looks good enough. The main reason I complained about the error message is that it sounds like you need Python in order to build Python. Obviously you need Python to run a modified file like typeslots.py, but there is supposed to be an

[issue15786] IDLE code completion window can hang or misbehave with mouse

2016-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, could you take at least a quick look at this troublesome issue? The issue seems to be this: idlelib.autocomplete_w.py has # at the top LISTUPDATE_SEQUENCE = "" # within show_window method self.listupdateid = listbox.bind(LISTUPDATE_SEQUENCE,

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Steven D'Aprano
On Thu, 21 Jul 2016 08:11 am, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 9:16:30 PM UTC+12, Peter Otten wrote: >> >> Lawrence D’Oliveiro wrote: >> >>> On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: >>> pylint can detect candidates for accidental

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 8:11 AM, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 9:16:30 PM UTC+12, Peter Otten wrote: >> >> Lawrence D’Oliveiro wrote: >> >>> On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: >>> pylint can detect

Re: can't add variables to instances of built-in classes

2016-07-20 Thread breamoreboy
On Wednesday, July 20, 2016 at 10:48:23 PM UTC+1, Lawrence D’Oliveiro wrote: > On Thursday, July 21, 2016 at 12:11:09 AM UTC+12, Steven D'Aprano wrote: > > > [long irrelevant rant deleted] > > Just because I pointed out what a load of nonsense you were spouting about > __slots__, by giving a

[issue734176] Make Tkinter.py's nametowidget work with cloned menu widgets

2016-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: Serhiy, if you are sure your patch is an improvement, then I think you should commit it without waiting for perfection. Only the other hand, #18686 does not demonstrate a problem *to me* as it does not fail for me. Does anyone else reproduce the failure on a

Re: reversed(enumerate(x))

2016-07-20 Thread Michael Selik
> On Jul 20, 2016, at 12:42 PM, Ian Kelly wrote: > >for i, n in reversed(enumerate(x)): pass > > fails with "TypeError: argument to reversed() must be a sequence". So make it a sequence: for i, n in reversed(list(enumerate(x))): pass If ``x`` is very large, you

[issue27568] "HTTPoxy", use of HTTP_PROXY flag supplied by attacker in CGI scripts

2016-07-20 Thread Martin Panter
Martin Panter added the comment: I think I misunderstood the Windows situation. Now I understand Windows has no lower-case variable names, so this patch would stop accepting any HTTP_PROXY variable there (in CGI mode). But that is okay by me. I agree the mixed-case scenario is not worth

[issue17310] Ctypes callbacks shows problem on Windows Python (64bit)

2016-07-20 Thread Patrick Stewart
Patrick Stewart added the comment: This also fixes python 3.5 -- nosy: +Patrick Stewart ___ Python tracker ___

[issue9618] IDLE shell ignores all but first statement

2016-07-20 Thread irdb
Changes by irdb : -- nosy: +irdb ___ Python tracker ___ ___ Python-bugs-list mailing

[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-07-20 Thread Martin Panter
Martin Panter added the comment: Mathieu: Maybe you haven’t seen some of the comments on your older patches. E.g. my comment on fromisoformat4.patch about improper use of “with self.assertRaises(...)” still stands. Also, adding some documentation to the patch might help the likes of Anders

[issue16198] IDLE - tabbing in a string always brings up file completion window

2016-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: It is intentional that be treated as a normal tab. The autocomplete_event tab handler begins with if hasattr(event, "mc_state") and event.mc_state: # A modifier was pressed along with the tab, continue as usual. return To fix the problem

[issue3559] IDLE: Pasted newline doesn't trigger execution when typed newline would

2016-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: My initial experiments indicate that pasted tabs are at least sometimes treated differently, but I need to do more to be sure. -- versions: -Python 3.4 ___ Python tracker

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7d8f988522ed by Victor Stinner in branch 'default': Issue #23951: remove devguide_theme_revised.patch https://hg.python.org/devguide/rev/7d8f988522ed -- ___ Python tracker

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Gregory Ewing
Random832 wrote: Well, your amp hours will be shittier with a lower voltage. Define "shittier". An incandescent flashlight (which consumes less power at lower voltage) will last longer, but won't be as bright. If it's still acceptably bright, that's not worse. I think the point is that the

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread STINNER Victor
STINNER Victor added the comment: Berker Peksag > -1. I think the current devguide theme looks fine and it would be nice to > keep devguide and Python documentations use different themes. I pushed the change because there were 3 positive votes and no negative vote, and I like the proposed

[issue27569] Windows install problems

2016-07-20 Thread Ricardo Esperanza
Ricardo Esperanza added the comment: Steve I tried again an installed correctly. Don´t understand what happened, but anyway it installed thanks -- ___ Python tracker

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Wednesday, July 20, 2016 at 9:16:30 PM UTC+12, Peter Otten wrote: > > Lawrence D’Oliveiro wrote: > >> On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: >> >>> pylint can detect candidates for accidental attribute creation: >> >> And __slots__ will prevent them outright. >

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Thursday, July 21, 2016 at 12:11:09 AM UTC+12, Steven D'Aprano wrote: > [long irrelevant rant deleted] Just because I pointed out what a load of nonsense you were spouting about __slots__, by giving a counterexample of their usefulness? Man, your pride must be hurt... --

apache not ale to execute a vbscript with python

2016-07-20 Thread vineeth menneni
Hi, I am trying to call a external vbscript through subprocess.call() it works fine with my local, but when i try to test apache says that no such file or directory. The problem here is that the vbscript should generate a .xlsx file and it is not being created. So apache gives a warning no

[issue27569] Windows install problems

2016-07-20 Thread Steve Dower
Steve Dower added the comment: That time it looks like it failed to install the launcher for all users. Did you get an elevation prompt? -- ___ Python tracker

[issue27294] Better repr for Tkinter event objects

2016-07-20 Thread Terry J. Reedy
Terry J. Reedy added the comment: Addendum: I verified flag 8 is Mod1 is Numlock on Windows. http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/event-handlers.html has table that claims that 8 is Left Alt and that 16 is NumLock. From what you say above, true on non-mac *nix, and only there.

[issue27294] Better repr for Tkinter event objects

2016-07-20 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- Removed message: http://bugs.python.org/msg268826 ___ Python tracker ___

[issue27294] Better repr for Tkinter event objects

2016-07-20 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- Removed message: http://bugs.python.org/msg268824 ___ Python tracker ___

[issue27575] dict viewkeys intersection slow for large dicts

2016-07-20 Thread David Su
Changes by David Su : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list

Re: reversed(enumerate(x))

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 5:13 AM, Steven D'Aprano wrote: > On Thu, 21 Jul 2016 03:46 am, Chris Angelico wrote: > >> On Thu, Jul 21, 2016 at 3:42 AM, Ian Kelly wrote: >>> I had occasion to write something like this: >>> >>> for i, n in

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-20 Thread Ned Deily
Ned Deily added the comment: I now see Vedran has already opened Issue27539 for this. Sorry for the additional noise. -- ___ Python tracker ___

[issue27576] An unexpected difference between dict and OrderedDict

2016-07-20 Thread Alakshendra Yadav
Changes by Alakshendra Yadav : -- nosy: +alakyadav ___ Python tracker ___ ___

[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-20 Thread Ned Deily
Ned Deily added the comment: @Vedran, the original issue is closed and the code for it already released. Please open a new issue referencing this one, otherwise your comments here will likely be forgotten. -- nosy: +ned.deily versions: -Python 3.6

Re: reversed(enumerate(x))

2016-07-20 Thread Random832
On Wed, Jul 20, 2016, at 13:42, Ian Kelly wrote: > I had occasion to write something like this: > > for i, n in reversed(enumerate(x)): pass > > How would you write this? I'd write my own version of enumerate with a step argument, and call enumerate(reversed(x), start=len(x), step=-1) --

Re: reversed(enumerate(x))

2016-07-20 Thread Steven D'Aprano
On Thu, 21 Jul 2016 03:46 am, Chris Angelico wrote: > On Thu, Jul 21, 2016 at 3:42 AM, Ian Kelly wrote: >> I had occasion to write something like this: >> >> for i, n in reversed(enumerate(x)): pass >> >> Of course this fails with "TypeError: argument to reversed()

[issue27574] Faster parsing keyword arguments

2016-07-20 Thread Brett Cannon
Brett Cannon added the comment: I haven't reviewed the patch, but the idea is great as I know one of Larry's hopes of using Argument Clinic was to allow for this kind of speed-up. -- nosy: +brett.cannon, larry ___ Python tracker

Re: reversed(enumerate(x))

2016-07-20 Thread Brendan Abel
You could create your own generator that wraps enumerate def reverse_enumerate(iterable): for i, val in enumerate(reversed(iterable)): yield len(iterable) - 1 - i, val for i, val in reverse_enumerate(x): ... On Wed, Jul 20, 2016 at 10:42 AM, Ian Kelly

Re: reversed(enumerate(x))

2016-07-20 Thread Chris Angelico
On Thu, Jul 21, 2016 at 3:42 AM, Ian Kelly wrote: > I had occasion to write something like this: > > for i, n in reversed(enumerate(x)): pass > > Of course this fails with "TypeError: argument to reversed() must be a > sequence". I ended up using this instead: > >

reversed(enumerate(x))

2016-07-20 Thread Ian Kelly
I had occasion to write something like this: for i, n in reversed(enumerate(x)): pass Of course this fails with "TypeError: argument to reversed() must be a sequence". I ended up using this instead: for i, n in zip(reversed(range(len(x))), reversed(x)): pass This works but is

[issue15443] datetime module has no support for nanoseconds

2016-07-20 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I've seen a similar glitch. Reloading the page usually fixes the problem. > On Jul 20, 2016, at 11:37 AM, Steve Holden wrote: > > > Steve Holden added the comment: > > BTW, I presume it's a bug in the issue tracker that my

[issue27579] Add a tutorial for AsyncIO in the documentation

2016-07-20 Thread Ludovic Gasc
Changes by Ludovic Gasc : -- nosy: +Ludovic.Gasc ___ Python tracker ___ ___

[issue15443] datetime module has no support for nanoseconds

2016-07-20 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: -pitrou ___ Python tracker ___ ___ Python-bugs-list

[issue15443] datetime module has no support for nanoseconds

2016-07-20 Thread R. David Murray
R. David Murray added the comment: I doubt it is a bug in the tracker. I've seen that kind of thing when I am having network issues...the browser renders what it gets, and if it doesn't get it all it looks like the page ends early. -- ___ Python

[issue15443] datetime module has no support for nanoseconds

2016-07-20 Thread Tim Peters
Tim Peters added the comment: FYI, I'm seeing the same kind of odd truncation Steve sees - but it goes away if I refresh the page. -- ___ Python tracker

[issue15443] datetime module has no support for nanoseconds

2016-07-20 Thread Steve Holden
Steve Holden added the comment: BTW, I presume it's a bug in the issue tracker that my view of this message ends after a few lines of msg166386? Makes it rather difficult to track the issue! -- ___ Python tracker

[issue1621] Do not assume signed integer overflow behavior

2016-07-20 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread Berker Peksag
Berker Peksag added the comment: Can we at least serve images and JS files (py.png -- this gives 404 now, copybutton.js, sidebar.js) from docs.python.org? It seems like devguide_theme_revised.patch was committed accidentally: https://hg.python.org/devguide/rev/9e7b1bc15ba7#l3.3 The color of

[issue8406] Make some setup.py paths exclude-able

2016-07-20 Thread Carol Willing
Carol Willing added the comment: Fair enough. Ronald and David, I respect your suggestions and thoughts, and I will not triage or close old issues. FWIW, I was trying to be helpful. We regularly close issues that are 1+ year old on Jupyter/IPython or rescope the issue to be actionable for

[issue8406] Make some setup.py paths exclude-able

2016-07-20 Thread R. David Murray
R. David Murray added the comment: Heh, that should have been "only close an old issue that hasn't been otherwise resolved if...". -- ___ Python tracker

[issue8406] Make some setup.py paths exclude-able

2016-07-20 Thread R. David Murray
R. David Murray added the comment: Right. Only close an issue if there is an existing open issue that addresses the topic better. Age alone is never a criteria for closing issues. Since Ronald agrees the other issue is enough we'll leave this closed, but it wouldn't be crazy to reopen it

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Marko Rauhamaa
Chris Angelico : > On Wed, Jul 20, 2016 at 11:54 PM, Marko Rauhamaa wrote: >> 2. Floating-point numbers are *imperfect approximations* of real >> numbers. Even when real numbers are derived exactly, >> floating-point operations may introduce "lossy

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread R. David Murray
R. David Murray added the comment: I think a reasonably consistent look and feel for all our docs is a good thing. It's a "branding" kind of thing. Differentiation by color works for me, but really I don't care about differentiating them, myself. (I actually find it jarring that I don't

[issue8406] Make some setup.py paths exclude-able

2016-07-20 Thread Ronald Oussoren
Ronald Oussoren added the comment: Did you create that new issue? If not this feature request will likely be forgotten. Hmmm... Issue7713 appears to be good enough for remembering that there is a problem with the way setup.py looks for libraries. --

[issue27579] Add a tutorial for AsyncIO in the documentation

2016-07-20 Thread Yury Selivanov
Yury Selivanov added the comment: I guess someone has to step forward -- i can propose an initial patch with the tutorial. -- ___ Python tracker ___

[issue8406] Make some setup.py paths exclude-able

2016-07-20 Thread Carol Willing
Carol Willing added the comment: Ronald, while I may have closed this issue prematurely in other folks' view, I did not do so without thought or reflecting if the issue was relevant. My recommendation to close the issue was based on several factors: - the desire to assist triaging issues that

[issue27579] Add a tutorial for AsyncIO in the documentation

2016-07-20 Thread Stéphane Wirtel
New submission from Stéphane Wirtel: The documentation of AsyncIO is well written for a developer, but it's a reference. We have the description of all the methods, classes, etc... But we want to learn to develop with AsyncIO, it's difficult, because there is no many examples in this

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread Carol Willing
Carol Willing added the comment: Lisa, thanks for your work and persistence on this patch. In particular, the pydoctheme's sidebar improves the user's ability to navigate through the devguide's content. Thank you! If folks desire more distinction between the devguide and the language docs,

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Chris Angelico
On Wed, Jul 20, 2016 at 11:54 PM, Marko Rauhamaa wrote: > 2. Floating-point numbers are *imperfect approximations* of real > numbers. Even when real numbers are derived exactly, floating-point > operations may introduce "lossy compression artifacts" that have to >

[issue13376] readline: pre_input_hook not getting called

2016-07-20 Thread Ronald Oussoren
Ronald Oussoren added the comment: The problem with fixing in editline is that Apple ships a copy of editline and that is used when build CPython by default. IMHO it would be acceptable to work around this in the readline extension if that can be done in a clean way. --

[issue8406] Make some setup.py paths exclude-able

2016-07-20 Thread Ronald Oussoren
Ronald Oussoren added the comment: I don't understand why this issue was closed. Apparently it was closed because it is an old issue without checking if the issue is still relevant??? To be honest the way setup.py looks for libraries could use some attention, the current methods is a bit too

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Random832
On Wed, Jul 20, 2016, at 03:16, Marko Rauhamaa wrote: > Random832 : > > Typically their capacity is labeled in amp-hours. > > Did you really see that labeled on the (nonrechargeable AA) battery? Sorry, I must have imagined that. Anyway, my point was that the reality is

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread Berker Peksag
Berker Peksag added the comment: -1 I think the current devguide theme looks fine and it would be nice to keep devguide and Python documentations use different themes. I'd be -0 if the patch was small, but diff stat "11 files changed, 1651 insertions(+), 10 deletions(-)" is huge and it would

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Marko Rauhamaa
Steven D'Aprano : > I am not a good computer scientist. But Bruce Dawson *is* a good > computer scientist: > > https://randomascii.wordpress.com/2014/01/27/theres-only-four-billion-f > loatsso-test-them-all/ > > Quote: > > Conventional wisdom says that you should never

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-20 Thread R. David Murray
R. David Murray added the comment: I agree that this is inconsistent. It might be quite tricky to fix, though, unless we special case file.endswith('__init__.py'), which feels like a hack. But maybe it is appropriate. -- nosy: +r.david.murray versions: +Python 3.6

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread alister
On Wed, 20 Jul 2016 02:09:58 +0300, Marko Rauhamaa wrote: > Ian Kelly : > >> Ah, the machinations that users of imperial units have to endure. > > Europeans often mistakenly believe that Americans haven't yet adopted > the SI units. They have: > > - the length of a ski

[issue20932] Undefined behavior flagged by Clang 3.4 (Python 3.5 from hg)

2016-07-20 Thread Martin Panter
Martin Panter added the comment: Serhiy’s patch does fix about half the errors (1 whole screenful reduces to a bit over 1/2 a screenful). I do find it a bit ugly though (four casts in the one term of a macro!). -- ___ Python tracker

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Steven D'Aprano
On Wed, 20 Jul 2016 05:09 pm, Antoon Pardon wrote: > Op 20-07-16 om 07:42 schreef Steven D'Aprano: >> Floating point maths is hard, thinking carefully about what you are doing >> and whether it is appropriate to use == or a fuzzy almost-equal >> comparison, or if equality is the right way at all.

[issue1621] Do not assume signed integer overflow behavior

2016-07-20 Thread Martin Panter
Martin Panter added the comment: Serhiy: slice-step.patch seems to be fine with negative slice steps. The actual indexes are still positive, and “unsigned” arithmetic is really modular arithmetic, so when you add the negative “unsigned” step value, it decrements the index properly. Antti: if

[issue14903] dictobject infinite loop in module set-up

2016-07-20 Thread Max Khon
Max Khon added the comment: I reproduced the problem with Python 2.7.5 as shipped with CentOS 7: root@192.168.0.86 /home/padmin # python -V Python 2.7.5 root@192.168.0.86 /home/padmin # rpm -q python python-2.7.5-34.el7.x86_64 root@192.168.0.86 /home/padmin # (gdb) bt #0 lookdict_string

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Steven D'Aprano
On Wed, 20 Jul 2016 06:50 pm, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: > >> pylint can detect candidates for accidental attribute creation: > > And __slots__ will prevent them outright. As well as those added intentionally. Sometimes I

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-20 Thread Alexander Todorov
New submission from Alexander Todorov: $ python2 Python 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> from pykickstart import handlers >>>

[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-07-20 Thread Martin Panter
Martin Panter added the comment: Here is a possible patch for 2.7. To fix everything on 2.7 I changed the module to accept input buffers over 2 GiB by enabling PY_SSIZE_T_CLEAN. As a consequence, the patch also includes ports of Nadeem Vawda’s adler32(), crc32() changes from Issue 10276, and

[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2016-07-20 Thread Stefan Krah
Stefan Krah added the comment: Apparently sysconfig.get_config_var() is already called in site.py anyway, so in principle I'm fine with using it here. In the stdlib it seems to be the first use outside site.py though, and site.py can be disabled by using "python -S", so perhaps we should be

[issue25571] Improve the lltrace feature with the Py_Debug mode

2016-07-20 Thread STINNER Victor
STINNER Victor added the comment: Sorry, I don't know what is the best place to add new unit tests. I don't know neither what is the best place to document the __ltrace__ feature. Maybe somewhere near: * https://docs.python.org/dev/library/debug.html Or maybe: *

[issue25571] Improve the lltrace feature with the Py_Debug mode

2016-07-20 Thread STINNER Victor
STINNER Victor added the comment: It would be nice to have unit tests and docs :-) For unit test, you can use a script like: --- def func(): return 1 __ltrace__ = True func() --- Run the script with test.support.assert_python_ok(), and check stdout. To skip the test if Python is compiled

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread STINNER Victor
STINNER Victor added the comment: I pushed your new style, thanks. I didn't see any malware in the new Javascript nor new HTML :-) I keep the issue open until the online doc is updated. -- ___ Python tracker

[issue23951] Update devguide style to use a similar theme as Docs

2016-07-20 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9e7b1bc15ba7 by Victor Stinner in branch 'default': Use the same style than Python ref doc https://hg.python.org/devguide/rev/9e7b1bc15ba7 -- nosy: +python-dev ___ Python tracker

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Peter Otten
Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: > >> pylint can detect candidates for accidental attribute creation: > > And __slots__ will prevent them outright. And attributes added intentionally. --

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Tuesday, July 19, 2016 at 9:48:15 AM UTC+12, I wrote: > When you have lots of read/write properties, I find __slots__ to be a good > idea. Let me amend that. When you have *any* read/write properties, I find __slots__ to be a good idea. --

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Wednesday, July 20, 2016 at 7:26:36 PM UTC+12, Peter Otten wrote: > pylint can detect candidates for accidental attribute creation: And __slots__ will prevent them outright. -- https://mail.python.org/mailman/listinfo/python-list

[issue25571] Improve the lltrace feature with the Py_Debug mode

2016-07-20 Thread Stéphane Wirtel
Stéphane Wirtel added the comment: Totally agree with you, I am going to check that, because currently, there is no test with this "hidden" feature in Python. I am going to discuss with Victor about this point. Thanks, Stephane On 07/20, Xavier Combelle wrote: > >Xavier Combelle added the

[issue25571] Improve the lltrace feature with the Py_Debug mode

2016-07-20 Thread Xavier Combelle
Xavier Combelle added the comment: I made some comment on code in review. A thing that worry me that there is zero automated test. In my opinion the minimal should be to test the expected output. A nice to have would be a test for the write_contents function of makeopcodetranslations.py

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

2016-07-20 Thread Xiang Zhang
Changes by Xiang Zhang : -- title: tuple and list parameter name conflicts between doc and implementation -> Make implementation and doc of tuple and list more compliant ___ Python tracker

[issue27577] tuple and list parameter name conflicts between doc and implementation

2016-07-20 Thread Xiang Zhang
New submission from Xiang Zhang: For tuple and list, their signatures are tuple([iterable]) and list([iterable]). But actually they support keyword argument *sequence*. The parameter names in doc are sometimes just placeholders but sometimes are real parameter names. So I suggest make the

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Marko Rauhamaa
Antoon Pardon : > But why perforem integer arithmetics in floats, Conceptual and practical simplificity. > isn't that a waste of time too? Probably not, especially compared with the overhead of boxing. Marko --

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Peter Otten
Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 6:19:45 PM UTC+12, Chris Angelico wrote: >> >> On Wed, Jul 20, 2016 at 9:58 AM, Lawrence D’Oliveiro wrote: >>> >>> On Wednesday, July 20, 2016 at 9:24:57 AM UTC+12, bream...@gmail.com >>> wrote: On Tuesday, July 19, 2016 at

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Steven D'Aprano
On Wednesday 20 July 2016 16:45, Lawrence D’Oliveiro wrote: > I was trying something like > > ctx.dashes = ((0.1, 0.03, 0.03, 0.03), 0) > > and wondering why it wasn’t working... And so are we. Since you've already solved the problem, maybe you could enlighten us?

Re: What exactly is "exact" (was Clean Singleton Docstrings)

2016-07-20 Thread Marko Rauhamaa
Random832 : > On Tue, Jul 19, 2016, at 18:17, Marko Rauhamaa wrote: >> I'd love it if batteries were priced per joule, or even per >> kilowatt-hour. > > Typically their capacity is labeled in amp-hours. Did you really see that labeled on the (nonrechargeable AA) battery?

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Antoon Pardon
Op 20-07-16 om 07:42 schreef Steven D'Aprano: > Floating point maths is hard, thinking carefully about what you are doing and > whether it is appropriate to use == or a fuzzy almost-equal comparison, or if > equality is the right way at all. > > "But thinking is hard, can't you just tell me the

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Lawrence D’Oliveiro
On Wednesday, July 20, 2016 at 6:19:45 PM UTC+12, Chris Angelico wrote: > > On Wed, Jul 20, 2016 at 9:58 AM, Lawrence D’Oliveiro wrote: >> >> On Wednesday, July 20, 2016 at 9:24:57 AM UTC+12, bream...@gmail.com wrote: >>> >>> On Tuesday, July 19, 2016 at 3:54:12 AM UTC+1, Lawrence D’Oliveiro

Re: can't add variables to instances of built-in classes

2016-07-20 Thread Chris Angelico
On Wed, Jul 20, 2016 at 9:58 AM, Lawrence D’Oliveiro wrote: > On Wednesday, July 20, 2016 at 9:24:57 AM UTC+12, bream...@gmail.com wrote: >> >> On Tuesday, July 19, 2016 at 3:54:12 AM UTC+1, Lawrence D’Oliveiro wrote: >>> >>> On Tuesday, July 19, 2016 at 11:12:52 AM

Re: Floating point equality [was Re: What exactly is "exact" (was Clean Singleton Docstrings)]

2016-07-20 Thread Chris Angelico
On Wed, Jul 20, 2016 at 3:42 PM, Steven D'Aprano wrote: > Arithmetic on integer-values (e.g. 1.0) is always exact, up to a limit of > either 2**53 or approximately 1e53, I forget which. (That's why most > Javascript > programmers fail to notice that they