[issue18844] allow weights in random.choice

2016-10-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset 433cff92d565 by Raymond Hettinger in branch '3.6': Issue #18844: Fix-up examples for random.choices(). Remove over-specified test. https://hg.python.org/cpython/rev/433cff92d565 -- ___ Python tracker

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-11 Thread Gregory Ewing
Paul Rubin wrote: Also if this operation is what it looks like, it's usually called "bind". seq is something else entirely. Ah, I hadn't realised there was already a function in Haskell called seq -- sorry about that! I don't really want to call the Python version 'bind', because it seems a

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-11 Thread Gregory Ewing
Anuradha Laxminarayan wrote: seq f g h = f (\s1 -> g h s1) better be written as seq f g x = f (\s1 -> g x s1) because naming conventions imply that h is function. Well, for the subset of monads I'm talking about, it always is a function -- it's the continuation to be run after f and g. --

Re: Pip error on installing Python 3.5

2016-10-11 Thread Zachary Ware
On Tue, Oct 11, 2016 at 7:07 PM, Steve D'Aprano wrote: > I've just installed Python 3.5 from the source tarball and received an > unexpected error related to pip. On Linux, as a regular user (except for > the last line): > > > wget

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread Gregory Ewing
Dennis Lee Bieber wrote: VMS documentation set was around 60 linear inches (two 30" shelves) of 3-ring binders. Amiga RKMs were five volumes with the main documentation in fine print -- two "pages" side-by-side on a landscape page. Apparently if you're writing software for the US Air

[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If run Python 3 with -bb: >>> __import__('encodings', fromlist=[b'aliases']) Traceback (most recent call last): File "", line 1, in File "", line 1000, in _handle_fromlist BytesWarning: Comparison between bytes and string -- nosy:

Re: OFF TOPIC mov is Turing complete

2016-10-11 Thread Michael Torrie
On 10/11/2016 09:19 PM, Steven D'Aprano wrote: > Completely off-topic, but too awesome not to share: > > The x86 assembly language "mov" instruction is Turing complete: > > https://www.cl.cam.ac.uk/~sd601/papers/mov.pdf And apparently someone has taken this and made a small C compiler that

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread eryk sun
On Wed, Oct 12, 2016 at 2:36 AM, wrote: > > I had try to find the document of the _winapi module, but can't find any in my > installed Python directory. Can you give me a link to look for? _winapi is not documented. It contains light wrappers around a small set of Windows

[issue28420] is ok

2016-10-11 Thread Zachary Ware
Changes by Zachary Ware : -- resolution: -> not a bug stage: -> resolved ___ Python tracker ___

[issue28411] Eliminate PyInterpreterState.modules.

2016-10-11 Thread Nick Coghlan
Nick Coghlan added the comment: I just checked the docs, and it turns out I'm wrong about this being a previously public API: "There are no public members in this structure." >From https://docs.python.org/3/c-api/init.html#c.PyInterpreterState That means the only externally supported API that

[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-11 Thread Nick Coghlan
Nick Coghlan added the comment: Thanks Berker - looks good to me! Should we file a separate issue regarding the similarly vague error message from hasattr() itself? -- ___ Python tracker

OFF TOPIC mov is Turing complete

2016-10-11 Thread Steven D'Aprano
Completely off-topic, but too awesome not to share: The x86 assembly language "mov" instruction is Turing complete: https://www.cl.cam.ac.uk/~sd601/papers/mov.pdf Abstract It is well-known that the x86 instruction set is baroque, overcom- plicated, and redundantly redundant. We show

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
On 10/11/2016 9:30 PM, Skip Montanaro wrote: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ethan Furman
On 10/11/2016 06:30 PM, Skip Montanaro wrote: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed

[issue28420] is ok

2016-10-11 Thread Xiang Zhang
Changes by Xiang Zhang : -- status: open -> closed ___ Python tracker ___ ___

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread jfong
wxjm...@gmail.com at 2016/10/11 9:40:21PM wrote: > If you are about to modify your registry, do not > forget to switch your Windows in a *utf-8 mode*. Have no idea how to "switch" Windows in a "utf-8 mode"? What will happens if not? Can you give a simple example? Thanks ahead. --Jach --

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread jfong
Hi, eryk, thanks for your solution. I had try to find the document of the _winapi module, but can't find any in my installed Python directory. Can you give me a link to look for? > This alone doesn't make the Windows API case sensitive, but it does > enable individual CreateFile calls to be

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ben Finney
Skip Montanaro writes: > > Only that one should not rely on ‘str’ preserving the value accurately, > > as documented in Python 2. > > Sure, but this choice is out of my hands. It's csv.writerow that calls > str(), not me. Ah, good old ‘csv’. If the implementation is

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
On 10/11/2016 8:59 PM, Skip Montanaro wrote: I'm trying to port some code from Python 2 to 3, and beyond the usual mechanical stuff, I've encountered a difference between the str() of floats. Here's an example. In Python 3 I get: print(repr(27.04 - 0.01)) 27.028 print(str(27.04 -

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Skip Montanaro
> Only that one should not rely on ‘str’ preserving the value accurately, > as documented in Python 2. Sure, but this choice is out of my hands. It's csv.writerow that calls str(), not me. I could probably subclass csv.writer and csv.DictWriter, and override the writerow method, but I would

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Skip Montanaro
> https://docs.python.org/3/whatsnew/3.1.html > > It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed was in str(). Skip --

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ben Finney
Skip Montanaro writes: > >>> print repr(27.04 - 0.01) > 27.028 > >>> print str(27.04 - 0.01) > 27.03 > > My test case writes through a csv writer, which writes the str() of each > element to the output. For Python 2, that's a mistake: str(object='')

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ethan Furman
On 10/11/2016 05:59 PM, Skip Montanaro wrote: Is there documentation of this particular change? My searching turned up documentation of plenty of other changes, but not this particular one. 3.1 What's new: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for

repr/str diff between Python 2 and 3

2016-10-11 Thread Skip Montanaro
I'm trying to port some code from Python 2 to 3, and beyond the usual mechanical stuff, I've encountered a difference between the str() of floats. Here's an example. In Python 3 I get: >>> print(repr(27.04 - 0.01)) 27.028 >>> print(str(27.04 - 0.01)) 27.028 but in Python

Pip error on installing Python 3.5

2016-10-11 Thread Steve D'Aprano
I've just installed Python 3.5 from the source tarball and received an unexpected error related to pip. On Linux, as a regular user (except for the last line): wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz tar xvf Python-3.5.2.tgz cd Python-3.5.2 ./configure make sudo make

[issue28420] is ok

2016-10-11 Thread Vagner Clementino
Changes by Vagner Clementino : -- nosy: Vagner Clementino priority: normal severity: normal status: open title: is ok ___ Python tracker

[issue28419] List comprehension in class scope does not have access to class scope

2016-10-11 Thread David Eyk
David Eyk added the comment: Thanks for the pointer. That seems weird and arbitrary when you think of it in terms of scope, but what can you do? All the same, thanks for the quick response. :) -- ___ Python tracker

Re: How to process syntax errors

2016-10-11 Thread Terry Reedy
On 10/11/2016 4:02 AM, Pierre-Alain Dorange wrote: Using this function, the code is "compiled". I do not think this function is often used and most python project simply use the interpreter (which do a small translation into byte-code to be faster and check syntax error before running

[issue28419] List comprehension in class scope does not have access to class scope

2016-10-11 Thread R. David Murray
R. David Murray added the comment: See issue 11796, and the issue it is marked as a duplicate of, for an explanation. -- nosy: +r.david.murray resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Comprehensions in a class definition mostly cannot access

Re: shadows name from outer scope

2016-10-11 Thread Terry Reedy
On 10/11/2016 11:50 AM, Daiyue Weng wrote: Hi, I have the following code structure, def one_func(param1, param2, param3): process_outcome = {'dict': None} outcome = another_func(param1, process_outcome, db_host=param2, funcs_to_run=param3) PyCharm warns me Shadows name from outer

[issue28411] Eliminate PyInterpreterState.modules.

2016-10-11 Thread Eric Snow
Eric Snow added the comment: Meh, there really isn't any need for _PyImport_GetModuleDict(). I'll drop it. Problem solved! :) -- ___ Python tracker

[issue28411] Eliminate PyInterpreterState.modules.

2016-10-11 Thread Eric Snow
Eric Snow added the comment: Hmm, actually _PyImport_GetModuleDict() isn't needed to solve the startup issue. It's still rather internally focused but the same could be said for PyImport_GetModuleDict(). I guess I'm still not sold on adding a new public API function for what amounts to a

[issue28411] Eliminate PyInterpreterState.modules.

2016-10-11 Thread Eric Snow
Eric Snow added the comment: What's the benefit to adding PyInterpreterState_GetModuleCache()? TBH, it should only be needed in this short period during startup when the import system hasn't been bootstrapped yet. After that code can import sys and access sys.modules from there. (For that

Re: while loop (Reposting On Python-List Prohibited)

2016-10-11 Thread BartC
On 11/10/2016 22:26, Lawrence D’Oliveiro wrote: On Wednesday, October 12, 2016 at 6:58:46 AM UTC+13, dhawan...@gmail.com wrote: Only first loop is executing not the second one? n=6 x=1 while x<=n: print("*"*x) x+=1 print('n=', n)

[issue21720] "TypeError: Item in ``from list'' not a string" message

2016-10-11 Thread Berker Peksag
Berker Peksag added the comment: Good catch, thanks Nick. Here's a Python 3 version of the patch. I excluded Python/importlib.h from the patch to make review easier. -- components: +Interpreter Core versions: +Python 3.5, Python 3.6, Python 3.7 Added file:

[issue28419] List comprehension in class scope does not have access to class scope

2016-10-11 Thread David Eyk
New submission from David Eyk: I've discovered what appears to be a scoping bug in Python 3.5.1, where the class scope is not available inside a list comprehension defined in the class scope. Attached is a simple example script, also available at the following gist:

Re: Python Shell in Russian exists/possible??

2016-10-11 Thread Андрей Логунов
среда, 12 октября 2016 г., 4:29:02 UTC+10 пользователь Michael Torrie написал: > On 10/11/2016 05:33 AM, Андрей Логунов wrote: > > I need the Python Shell for use in education (turtle graphics, etc.), > > but the UI must be localized in the Russian language. The question is > > if it's at all

[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-10-11 Thread Martin Panter
Martin Panter added the comment: For arbitrary C-contiguous buffers aka “bytes-like objects” (which are not just arrays of bytes), I think this trick relies on Issue 15944, which is only added in 3.5+. -- ___ Python tracker

[issue28418] Raise Deprecation warning for tokenize.generate_tokens

2016-10-11 Thread Martin Panter
Martin Panter added the comment: There is related discussion in Issue 12486 about supporting unencoded text input. The current patch there actually already raises a warning and removes call sites from the Python library, though it does not add a doc string. -- nosy: +martin.panter

[issue28393] Update encoding lookup docs wrt #27938

2016-10-11 Thread Ville Skyttä
Ville Skyttä added the comment: I believe (but haven't checked) that additionally, encoding names are case insensitive with respect to the fast-path behavior. But then again I also suppose that's the way it was before #27938 as well, which is why I didn't change that in this patch. But why

Re: Conventions and requirements for a python module

2016-10-11 Thread Michael Felt
On 11/10/2016 17:30, Michael Torrie wrote: On 10/11/2016 08:29 AM, Michael Felt wrote: From reading the python source, and other projects I am looking to patch I see that there is often a file __init__.py, sometimes empty (only comments), sometimes not. I have tried looking in what I hope

[issue28393] Update encoding lookup docs wrt #27938

2016-10-11 Thread Berker Peksag
Berker Peksag added the comment: Thanks for the patch! Do we still need to keep the last sentence? Is there any other alternatives that can be used? Perhaps the word "spellings" can be changed with "aliases" to make the sentence a little bit clearer. -- nosy: +berker.peksag stage: ->

[issue28416] defining persistent_id in _pickle.Pickler subclass causes reference cycle

2016-10-11 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +serhiy.storchaka type: behavior -> resource usage versions: +Python 2.7, Python 3.6, Python 3.7 ___ Python tracker

Re: Python code is compiled before execution

2016-10-11 Thread BartC
On 11/10/2016 18:14, Steve D'Aprano wrote: On Wed, 12 Oct 2016 12:19 am, BartC wrote: Python is not really suited for AOT native-code compilation. You might be right, but the author of Nuitka disagrees. http://nuitka.net/ I tried the same thing with a dynamic language: translating

[issue28418] Raise Deprecation warning for tokenize.generate_tokens

2016-10-11 Thread Matthias Bussonnier
New submission from Matthias Bussonnier: the Tokenize module has the following code: # An undocumented, backwards compatible, API for all the places in the standard # library that expect to be able to use tokenize with strings def generate_tokens(readline): return _tokenize(readline, None)

[RELEASE] Python 3.6.0b2 is now available

2016-10-11 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release team, I'm happy to announce the availability of Python 3.6.0b2. 3.6.0b2 is the second of four planned beta releases of Python 3.6, the next major release of Python, and marks the end of the feature development phase for 3.6.

ANN: Experimental Ruby to Python 3 translator

2016-10-11 Thread Michal Molhanec
Experimental Ruby to Python 3 translator Currently very far from production-ready state, more like a toy for experiments. That said, it is however able to translate Ruby Prawn library for generating PDF files and the produced library is able to produce simple PDF files. Code + Prawn

Re: Not getting output

2016-10-11 Thread BartC
On 11/10/2016 18:57, dhawanpawa...@gmail.com wrote: def abc(a,b): l=[] for i in range(a,b+1): if i%2!=0: l.append(i) print l return 1 def bg(): y=abc(11,31) print y I am not getting the output, but if i call method abc outside the function then it's

Re: while loop

2016-10-11 Thread Jussi Piitulainen
dhawanpawa...@gmail.com writes: > n=6 > x=1 > while x<=n: > print "*"*x > x+=1 > while n>=x: > n=n-1 > print "*"* n > > > Only first loop is executing not the second one? It's a basic fact about while loops that after the loop the condition is false. The two conditions x <= n

Re: Not getting output

2016-10-11 Thread Michael Torrie
On 10/11/2016 11:57 AM, dhawanpawa...@gmail.com wrote: > def abc(a,b): > l=[] > for i in range(a,b+1): > if i%2!=0: > > l.append(i) > print l > return 1 > > def bg(): > y=abc(11,31) > print y > I am not getting the output, but if i call

Re: Not getting output

2016-10-11 Thread Jussi Piitulainen
dhawanpawa...@gmail.com writes: > def abc(a,b): > l=[] > for i in range(a,b+1): > if i%2!=0: > > l.append(i) > print l > return 1 > > def bg(): > y=abc(11,31) > print y > > I am not getting the output, but if i call method abc outside

Re: while loop

2016-10-11 Thread Michael Torrie
On 10/11/2016 11:58 AM, dhawanpawa...@gmail.com wrote: > > n=6 > x=1 > while x<=n: > print "*"*x > x+=1 > while n>=x: > n=n-1 > print "*"* n > > > Only first loop is executing not the second one? Did you try printing out the loop variable to see what it does and what it is

Re: Python Shell in Russian exists/possible??

2016-10-11 Thread Michael Torrie
On 10/11/2016 05:33 AM, Андрей Логунов wrote: > I need the Python Shell for use in education (turtle graphics, etc.), > but the UI must be localized in the Russian language. The question is > if it's at all possible to feed the strings in or rebuild it or... For educational purposes, you might

Re: while loop

2016-10-11 Thread Larry Martell
On Tue, Oct 11, 2016 at 1:58 PM, wrote: > > n=6 > x=1 > while x<=n: > print "*"*x > x+=1 > while n>=x: > n=n-1 > print "*"* n > > > Only first loop is executing not the second one? Because after the first loop n < x --

while loop

2016-10-11 Thread dhawanpawan32
n=6 x=1 while x<=n: print "*"*x x+=1 while n>=x: n=n-1 print "*"* n Only first loop is executing not the second one? -- https://mail.python.org/mailman/listinfo/python-list

Not getting output

2016-10-11 Thread dhawanpawan32
def abc(a,b): l=[] for i in range(a,b+1): if i%2!=0: l.append(i) print l return 1 def bg(): y=abc(11,31) print y I am not getting the output, but if i call method abc outside the function then it's coming --

[issue28416] defining persistent_id in _pickle.Pickler subclass causes reference cycle

2016-10-11 Thread SilentGhost
Changes by SilentGhost : -- nosy: +alexandre.vassalotti ___ Python tracker ___ ___

[issue24398] Update test_capi to use test.support.script_helper

2016-10-11 Thread Aidin Gharibnavaz
Aidin Gharibnavaz added the comment: I tested the patch locally, on my Gnu/Linux machine, and it seems fine. -- keywords: +patch Added file: http://bugs.python.org/file45060/issue24398.patch ___ Python tracker

[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Even in 3.3+. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-11 Thread Rustom Mody
On Tuesday, October 11, 2016 at 9:53:25 PM UTC+5:30, Anuradha Laxminarayan wrote: > On Sunday, 9 October 2016 13:18:32 UTC+5:30, Gregory Ewing wrote: > > Here's the first part of the essay I said I'd write about > > monads: > > > >

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-11 Thread Paul Rubin
Anuradha Laxminarayan writes: > seq f g x = f (\s1 -> g x s1) > because naming conventions imply that h is function. Also if this operation is what it looks like, it's usually called "bind". seq is something else entirely. --

Re: Python code is compiled before execution

2016-10-11 Thread Steve D'Aprano
On Wed, 12 Oct 2016 12:19 am, BartC wrote: > Python is not really suited for AOT native-code compilation. You might be right, but the author of Nuitka disagrees. http://nuitka.net/ Nice to see that there's a new release, only a week or so ago! -- Steve “Cheer up,” they said, “things

Re: How to process syntax errors

2016-10-11 Thread Steve D'Aprano
On Tue, 11 Oct 2016 03:58 pm, Terry Reedy wrote: > On 10/10/2016 11:24 AM, Chris Angelico wrote: >> On Tue, Oct 11, 2016 at 1:13 AM, wrote: >>> Is there any way to capture syntax errors and process them ? I want to >>> write a function which calls every time whenever

Re: Python Shell in Russian exists/possible??

2016-10-11 Thread Steve D'Aprano
On Tue, 11 Oct 2016 10:33 pm, Андрей Логунов wrote: > I need the Python Shell for use in education (turtle graphics, etc.), but > the UI must be localized in the Russian language. The question is if it's > at all possible to feed the strings in or rebuild it or... Yes it is possible, but it is

[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

Re: Python code is compiled before execution

2016-10-11 Thread Pierre-Alain Dorange
Grant Edwards wrote: > > For my part, i differenciate a strict compilation (ie. C) from a > > translation into byte-code (ie. Python). > > FWIW I've seen C compilers that produced byte-code. They allowed for > a highly interactive developemnt environment. I do not

[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-10-11 Thread Nick Coghlan
Nick Coghlan added the comment: Something else the PEP needs to be updated to cover is that in 3.5+ (and maybe even in 3.4 - I'm not sure when 'c' support landed in memoryview) you can write the following efficient bytes iterator: def iterbytes(data): return

Re: Python code is compiled before execution

2016-10-11 Thread Grant Edwards
On 2016-10-11, Pierre-Alain Dorange wrote: > For my part, i differenciate a strict compilation (ie. C) from a > translation into byte-code (ie. Python). FWIW I've seen C compilers that produced byte-code. They allowed for a highly interactive developemnt

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-11 Thread Anuradha Laxminarayan
On Sunday, 9 October 2016 13:18:32 UTC+5:30, Gregory Ewing wrote: > Here's the first part of the essay I said I'd write about > monads: > > http://www.cosc.canterbury.ac.nz/greg.ewing/essays/monads/DemystifyingMonads.html > > Hope it's useful, > Greg Thanks, that made a very interesting read.

[issue28417] va_end twice in PyUnicode_FromFormatV

2016-10-11 Thread Xiang Zhang
New submission from Xiang Zhang: vargs2 could be va_end()ed twice in PyUnicode_FromFormatV when format contains non-ascii characters. Once va_end()ed, vargs2 is undefined. So this could lead to undefined behaviour. -- components: Interpreter Core files: PyUnicode_FromFormatV.patch

[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-10-11 Thread Andreas Gnau
Changes by Andreas Gnau : -- nosy: +Rondom ___ Python tracker ___ ___ Python-bugs-list

[issue28416] defining persistent_id in _pickle.Pickler subclass causes reference cycle

2016-10-11 Thread Carl Witty
New submission from Carl Witty: On creation, _pickle.Pickler caches any .persistent_id() method defined by a subclass (in the pers_func field of PicklerObject). This causes a reference cycle (pickler -> bound method of pickler -> pickler), so the pickler is held in memory until the next

shadows name from outer scope

2016-10-11 Thread Daiyue Weng
Hi, I have the following code structure, def one_func(param1, param2, param3): process_outcome = {'dict': None} outcome = another_func(param1, process_outcome, db_host=param2, funcs_to_run=param3) PyCharm warns me Shadows name from outer scope on every variable here, param1,2,3,

[issue11429] ctypes is highly eclectic in its raw-memory support

2016-10-11 Thread Andreas Gnau
Changes by Andreas Gnau : -- nosy: +Rondom ___ Python tracker ___ ___ Python-bugs-list

[issue18233] SSLSocket.getpeercertchain()

2016-10-11 Thread Mariusz Masztalerczuk
Mariusz Masztalerczuk added the comment: Hello :) I'm not sure why patches created by christian.heimes is not merged to python, but because last patch was created in 2013, I've created a new version of this patch. What do you think about it? -- nosy: +mmasztalerczuk Added file:

Re: Conventions and requirements for a python module

2016-10-11 Thread Michael Torrie
On 10/11/2016 08:29 AM, Michael Felt wrote: > From reading the python source, and other projects I am looking to > patch I see that there is often a file __init__.py, sometimes empty > (only comments), sometimes not. > > I have tried looking in what I hope are the "regular" places such as: >

[issue28397] Faster index range checks

2016-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Raymond extracted his optimization into separate function and commented it. -- ___ Python tracker ___

[issue17305] IDNA2008 encoding missing

2016-10-11 Thread Christian Heimes
Christian Heimes added the comment: I'm considering lack of IDNA 2008 a security issue for applications that perform DNS lookups and X.509 cert validation. Applications may end up connecting to the wrong machine and even validate the cert correctly. Wrong: >>> import socket >>>

[issue28409] test.regrtest does not support multiple -x flags

2016-10-11 Thread STINNER Victor
STINNER Victor added the comment: Attached patch should fix the issue. I didn't know that argparse was so strict: "arg1 -v arg2" is not supported by default, see the issue #14191, whereas it works well with optparse. The patch uses parse_known_args() as a workaround, and then manually checks

[issue28397] Faster index range checks

2016-10-11 Thread STINNER Victor
STINNER Victor added the comment: Serhiy Storchaka: "I opened this issue because this optimization already was applied to deque (issue23553)" Ah, change 1e89094998b2 written by Raymond Hettinger last year, Raymond who wrote (msg278397): "Don't change the code in the collections module. While

Conventions and requirements for a python module

2016-10-11 Thread Michael Felt
From reading the python source, and other projects I am looking to patch I see that there is often a file __init__.py, sometimes empty (only comments), sometimes not. I have tried looking in what I hope are the "regular" places such as: https://docs.python.org, readthedocs (it took 454

[issue28397] Faster index range checks

2016-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Unlikely this optimization have measurable affect on benchmarks. I opened this issue because this optimization already was applied to deque (issue23553), and it is easy to write a script for applying it to all code. But since there are doubts about this

[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Anton Sychugov
Anton Sychugov added the comment: Yes, I misspelled, match_hostname() fails with ssl.CertificateError. -- ___ Python tracker ___

[issue28409] test.regrtest does not support multiple -x flags

2016-10-11 Thread STINNER Victor
STINNER Victor added the comment: Xiang: "This regression is introduced in 4df2d43e995d." Sorry, my commit message is very short. I made this change because I was very annoying of getting "unknown test -m" and "unknown test test_access" when using the -m option to filter tests: ./python

[issue28397] Faster index range checks

2016-10-11 Thread STINNER Victor
STINNER Victor added the comment: Serhiy: "The latter form generates simpler machine code." Since this issue is an optimization, can you please provide results of Python benchmarks? Maybe run the performance benchmark suite? I just released performance 0.3 with new benchmarks and less bugs!

[issue28397] Faster index range checks

2016-10-11 Thread Stefan Krah
Stefan Krah added the comment: On 64-bit Linux there's no difference: $ ./usr/bin/gcc -O3 -o issue28397-2 issue28397-2.c $ time ./issue28397-2 0 real0m2.486s user0m2.424s sys 0m0.014s $ time ./issue28397-2 1 real0m2.433s user0m2.422s sys 0m0.008s Also, most of the

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread BartC
On 11/10/2016 13:49, Dennis Lee Bieber wrote: Unfortunately, Windows is one of the poorest documented OS I've encountered The problem is more that there is too much documentation! -- Bartc -- https://mail.python.org/mailman/listinfo/python-list

[issue28397] Faster index range checks

2016-10-11 Thread Марк Коренберг
Марк Коренберг added the comment: $ gcc -O3 -DDOIT=doit ./zzz.c -o zzz && time ./zzz real0m1.675s user0m1.672s sys 0m0.000s $ gcc -O3 -DDOIT=doit2 ./zzz.c -o zzz && time ./zzz real0m1.657s user0m1.656s sys 0m0.000s

[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Christian Heimes
Changes by Christian Heimes : -- versions: +Python 2.7, Python 3.6, Python 3.7 -Python 3.4 ___ Python tracker ___

[issue28414] SSL match_hostname fails for internationalized domain names

2016-10-11 Thread Christian Heimes
Christian Heimes added the comment: Thanks for bringing this to my attention. I can confirm that the code is broken. Further more there are no tests for IDN for server_hostname. * server_hostname must be an IDN U-label (locälhost) * SSL handshake correctly converts and sends TLS SNI as IDN

Re: Python code is compiled before execution

2016-10-11 Thread BartC
On 11/10/2016 13:35, Pierre-Alain Dorange wrote: Ben Finney wrote: The "small translation into byte-code" *is* compilation. Don't make the mistake that the only product of "compile" is some CPU code; that is a foolishly narrow definition. OK right. For my part,

[issue28409] test.regrtest does not support multiple -x flags

2016-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, this is not a regression in argparse itself, nor in regrtest (as Xiang pointed, original example is incorrect use). But I'm not sure about the support of options after positional arguments. This is dangerous feature. I'm going to investigate this

[issue28397] Faster index range checks

2016-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In your example functions are inlined. If prohibit inlining, the second function is faster. $ gcc -O3 -o issue28397 issue28397-2.c $ time ./issue28397 0 real0m8.097s user0m7.992s sys 0m0.012s $ time ./issue28397 1 real0m5.467s user

Re: Is it possible Python can distinguish capital letter and small letter in the path of Windows?

2016-10-11 Thread eryk sun
On Tue, Oct 11, 2016 at 10:34 AM, wrote: > I have two files in the Q:\lib directory: > > Q:\lib>dir > 2007/03/11 AM 08:025,260 lib_MARK.so > 2007/03/11 AM 08:024,584 lib_mark.so > > Under Python 3.4.4 I got: > f = open('lib_MARK.so', 'br') data =

[issue28409] test.regrtest does not support multiple -x flags

2016-10-11 Thread R. David Murray
R. David Murray added the comment: OK, so this isn't a regression in argparse itself? I thought you meant it was, which is why I set it to release blocker. -- ___ Python tracker

Re: Python code is compiled before execution

2016-10-11 Thread Pierre-Alain Dorange
Ben Finney wrote: > The "small translation into byte-code" *is* compilation. > > Don't make the mistake that the only product of "compile" is some CPU > code; that is a foolishly narrow definition. OK right. For my part, i differenciate a strict compilation (ie. C)

[issue28397] Faster index range checks

2016-10-11 Thread Stefan Krah
Stefan Krah added the comment: That matches my results as well: -O2 gives about the same speed, with -O3 doit() has a huge advantage. I'm not sure this is an optimization at all. -- ___ Python tracker

[issue28397] Faster index range checks

2016-10-11 Thread Марк Коренберг
Марк Коренберг added the comment: Without optimisation in compiler (-O0) speed is the same. -- ___ Python tracker ___

[issue28397] Faster index range checks

2016-10-11 Thread Марк Коренберг
Марк Коренберг added the comment: $ gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.2) 5.4.0 20160609 -- ___ Python tracker ___

[issue28397] Faster index range checks

2016-10-11 Thread Марк Коренберг
Марк Коренберг added the comment: -O2 -- the same speed too! -O3 really helps. -- ___ Python tracker ___ ___

  1   2   >