Re: Keypress Input

2015-07-16 Thread Rick Johnson
On Wednesday, July 15, 2015 at 11:30:40 PM UTC-5, Michael Torrie wrote: On 07/15/2015 07:03 PM, Rick Johnson wrote: too much to quote I think you've missed the whole point of the OP's project. Obviously my reply was not only too much to quote, but apparently, and sadly, too much to read!

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Joonas Liik
On 16 July 2015 at 20:03, Chris Angelico ros...@gmail.com wrote: The trouble with that is that it can quickly run you out memory when you accidentally trigger infinite recursion. A classic example is a simple wrapper function... def print(msg): print(ctime()+ +msg) With the recursion

How does a dictionary work exactly?

2015-07-16 Thread yoursurrogate...@gmail.com
Hello, I was trying to see how some have implemented a hashtable. I took a gather at dictobject.h/.c. It seems that underneath it all it's a linked list and that is used in order to store the actual information (I'm looking at PyDictEntry.) Am I correct in my assumption or is there more to

[issue24630] null pointer dereference in `load_newobj_ex`

2015-07-16 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - out of date stage: - resolved status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24630 ___

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Chris Angelico
On Fri, Jul 17, 2015 at 3:34 AM, Joonas Liik liik.joo...@gmail.com wrote: That all sounds reasonable. However that can be looked another way. Soppose you have some code that traverses some tree, a strange imbalanced tree (say from some xml) It is, semantically at least, a reasonable aproach

Re: A new module for performing tail-call elimination

2015-07-16 Thread Ethan Furman
On 07/16/2015 01:07 AM, Steven D'Aprano wrote: The point is, people keep insisting that there are a vast number of algorithms which are best expressed using recursion and which require TCO to be practical, and yet when asked for examples they either can't give any examples at all, or they give

Re: How does a dictionary work exactly?

2015-07-16 Thread Skip Montanaro
I was trying to see how some have implemented a hashtable. I took a gather at dictobject.h/.c. It seems that underneath it all it's a linked list and that is used in order to store the actual information (I'm looking at PyDictEntry.) Am I correct in my assumption or is there more to

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Joonas Liik
On 16 July 2015 at 20:49, Chris Angelico ros...@gmail.com wrote: This sounds like a denial-of-service attack. If you can state that no reasonable document will ever have more than 100 levels of nesting, then you can equally state that cutting the parser off with a tidy exception if it exceeds

[issue24644] --help for runnable stdlib modules

2015-07-16 Thread R. David Murray
R. David Murray added the comment: Please open individual issues to address individual modules that you would like to contribute to improving. Adding/fixing help is often best done by rewriting the argument parsing...contributions have been made to improve several modules already. In most

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Steven D'Aprano
On Fri, 17 Jul 2015 03:34 am, Joonas Liik wrote: Now i admit that it is possible to have infinite recursion but it is also possiblew to have infinite loops. and we don't kill your code after 1000 iterations of a while loop so why should we treat recursion any differently? Because a while

Re: A new module for performing tail-call elimination

2015-07-16 Thread Steven D'Aprano
On Thu, 16 Jul 2015 08:41 pm, Antoon Pardon wrote: On 07/16/2015 10:07 AM, Steven D'Aprano wrote: On Wednesday 15 July 2015 19:29, Antoon Pardon wrote: Suppose I start with the following: def even(n): True if n == 0 else odd(n - 1) def odd(n): False if n == 0 else even(n - 1)

Re: Where is pyvenv.py in new Python3.4 environment on CentOS7?

2015-07-16 Thread David Karr
On Thursday, July 16, 2015 at 1:14:22 AM UTC-7, INADA Naoki wrote: How about `python3 -m venv` ? I guess that works, thanks. On Thu, Jul 16, 2015 at 6:54 AM, David Karr davidmic...@gmail.com wrote: I'm just learning more about Python (although I've been a Java dev for many years, and C/C++

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Joonas Liik
On 16 July 2015 at 21:58, Steven D'Aprano st...@pearwood.info wrote: On Fri, 17 Jul 2015 03:34 am, Joonas Liik wrote: Now i admit that it is possible to have infinite recursion but it is also possiblew to have infinite loops. and we don't kill your code after 1000 iterations of a while loop

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Terry Reedy
On 7/16/2015 7:45 AM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 5:31 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Traceback are not the only or even the most useful tool for debugging code. The current stack trace doesn't even contain the value's of the variables on the stack.

[issue24645] logging.handlers.QueueHandler should not lock when handling a record

2015-07-16 Thread R. David Murray
R. David Murray added the comment: I can't see doing io in __repr__ ever making sense, so I'm not sure this is a use case we care about. But Vinay might not have any objection to removing locking if it is redundant, so we'll see what he has to say. --

Re: Keypress Input

2015-07-16 Thread Terry Reedy
On 7/15/2015 9:03 PM, Rick Johnson wrote: You may have solved your input capturing problem, and i don't think a GUI is the preferred solution for a graphically deficient device anyhow, but you may well need a GUI in the future, and this would be a fine example from which to learn. This really

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Zachary Ware
On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Fine by me. What is the mapping API that needs to be implemented though? Have a look at collections.MutableMapping. -- Zach -- https://mail.python.org/mailman/listinfo/python-list

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Ben Finney
Terry Reedy tjre...@udel.edu writes: On 7/15/2015 9:51 PM, Ben Finney wrote: What well-defined data type exists with the following properties: * Mapping, key → value. * Each key is a sequence (e.g. `tuple`) of items such as text strings. * Items in a key may be the sentinel `ANY`

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Chris Angelico
On Thu, Jul 16, 2015 at 3:55 PM, Ben Finney ben+pyt...@benfinney.id.au wrote: Thanks. The part which puzzle me though: How do we teach the mapping type about that matching behaviour? I'm not sure you really need a mapping type per se. The benefit of something like Python's dict is that it gives

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: I'm not sure you really need a mapping type per se. My reasons include (but I can probably think of more) testing membership via the ‘key in mapping’ syntax. with the match any concept, there's actually a potential for ambiguities, which means you need

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Ethan Furman
On 07/15/2015 10:53 PM, Ben Finney wrote: Steven D'Aprano st...@pearwood.info writes: You can't use a dict for the mapping, not unless you're smarter than me, due to the requirement to hash the keys. Dang. It's the mapping that I really need to solve, I think. A mapping that has a custom

[issue23601] use small object allocator for dict key storage

2015-07-16 Thread Stefan Behnel
Stefan Behnel added the comment: Benchmark results look good to me (although a header line is missing) and seem to match my expectations. Sounds like we should allow this change. -- ___ Python tracker rep...@bugs.python.org

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Ben Finney
Ethan Furman et...@stoneleaf.us writes: On 07/15/2015 10:53 PM, Ben Finney wrote: Are those the ‘__contains__’, ‘__getitem__’ methods? What actually is the API of a mapping type, that would need to be customised for this application? The problem is that potential key matches are found by

[issue24632] Improve documentation about __main__.py

2015-07-16 Thread Ezio Melotti
Ezio Melotti added the comment: I think this is due to PEP 420 Namespace Packages. It works on Python 2 too: $ ls execdir/ foo.py __main__.py $ cat execdir/foo.py print(foo imported) $ cat execdir/__main__.py import foo; print(main imported) $ python execdir/ foo imported main imported $

Re: A new module for performing tail-call elimination

2015-07-16 Thread Antoon Pardon
On 07/15/2015 11:19 PM, Terry Reedy wrote: On 7/15/2015 5:29 AM, Antoon Pardon wrote: Can you explain how you would do mutual recursive functions? Suppose I start with the following: def even(n): True if n == 0 else odd(n - 1) def odd(n): False if n == 0 else even(n - 1) How

Re: Where is pyvenv.py in new Python3.4 environment on CentOS7?

2015-07-16 Thread INADA Naoki
How about `python3 -m venv` ? On Thu, Jul 16, 2015 at 6:54 AM, David Karr davidmichaelk...@gmail.com wrote: I'm just learning more about Python (although I've been a Java dev for many years, and C/C++ before that). A book I'm reading (Learning Python Network Programming) refers to running

[issue24642] Will there be an MSI installer?

2015-07-16 Thread Alex Walters
New submission from Alex Walters: I use the *.msi installers for python to automate deployment of... an absurd number of python installations. I have been able to do this relatively easily, as the Windows installer didn't change much between 2.6 and 3.4 (possibly much longer than that, but I

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Marko Rauhamaa
Ben Finney ben+pyt...@benfinney.id.au: What well-defined data type exists with the following properties: * Mapping, key → value. * Each key is a sequence (e.g. `tuple`) of items such as text strings. * Items in a key may be the sentinel `ANY` value, which will match any value at that

[issue24583] set.update(): Crash when source set is changed during merging

2015-07-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5c3812412b6f by Raymond Hettinger in branch '3.5': Issue #24583: Fix crash when set is mutated while being updated. https://hg.python.org/cpython/rev/5c3812412b6f New changeset 05cb67dab161 by Raymond Hettinger in branch 'default': Issue #24583:

Re: A new module for performing tail-call elimination

2015-07-16 Thread Steven D'Aprano
On Wednesday 15 July 2015 19:29, Antoon Pardon wrote: Suppose I start with the following: def even(n): True if n == 0 else odd(n - 1) def odd(n): False if n == 0 else even(n - 1) Well, both of those always return None, so can be optimized to: even = odd = lambda x: None :-)

Re: A new module for performing tail-call elimination

2015-07-16 Thread Marko Rauhamaa
Robin Becker ro...@reportlab.com: which is said to be not primitive recursive ie cannot be unwound into loops; not sure whether that implies it has to be recursively defined or can perhaps be broken down some other way. For more eye-glazing You only need a single while loop plus primitive

Re: Why pay DICE When TheGongzuo.com is !! FREE !!

2015-07-16 Thread David H. Lipman
Steve Hayes wrote in message news:gaibqatads4eamjchr9k4f5tau30un2...@4ax.com... On Tue, 14 Jul 2015 17:31:31 -0700 (PDT), trentonwesle...@gmail.com wrote: Greetings! You been Invited as a Beta User for TheGongzuo.com ( Absolutely Extended Trial). We bring to you TheGongzuo.com, Top notch

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Laura Creighton
I'm ill, so I am not trusting my own reasoning further than I can jump (not too far today) but I don't think you have a problem that is well-suited to a mapping. But it seems like a perfect fit for a tree, to me. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: A new module for performing tail-call elimination

2015-07-16 Thread Robin Becker
.. The point is, people keep insisting that there are a vast number of algorithms which are best expressed using recursion and which require TCO to be practical, and yet when asked for examples they either can't give any examples at all, or they give examples that are not well-suited to

[issue17359] Mention __main__.py explicitly in command line docs

2015-07-16 Thread Ezio Melotti
Ezio Melotti added the comment: See also #24632. -- nosy: +ezio.melotti type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17359 ___

[issue24642] Will there be an MSI installer?

2015-07-16 Thread STINNER Victor
Changes by STINNER Victor victor.stin...@gmail.com: -- components: +Installation ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24642 ___ ___

Re: A new module for performing tail-call elimination

2015-07-16 Thread Chris Angelico
On Thu, Jul 16, 2015 at 8:41 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Fixing the obvious mistake (failing to return anything) leads to the next mistake. When all you have is a hammer, everything looks like a nail. def even(n): return n%2 == 0 def odd(n): return n%2 !=

Re: A new module for performing tail-call elimination

2015-07-16 Thread Robin Becker
On 16/07/2015 09:07, Steven D'Aprano wrote: . Fixing the obvious mistake (failing to return anything) leads to the next mistake. When all you have is a hammer, everything looks like a nail. def even(n): return n%2 == 0 def odd(n): return n%2 != 0 .. what about def

[issue23319] Missing SWAP_INT in I_set_sw

2015-07-16 Thread Matthieu Gautier
Matthieu Gautier added the comment: The bug is also present in Python 2.7. Is it possible to backport this fix ? -- versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23319

Re: A new module for performing tail-call elimination

2015-07-16 Thread Antoon Pardon
On 07/16/2015 10:07 AM, Steven D'Aprano wrote: On Wednesday 15 July 2015 19:29, Antoon Pardon wrote: Suppose I start with the following: def even(n): True if n == 0 else odd(n - 1) def odd(n): False if n == 0 else even(n - 1) Well, both of those always return None, so can be

[issue24583] set.update(): Crash when source set is changed during merging

2015-07-16 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24583 ___

[issue24621] zipfile.BadZipFile: File is not a zip file

2015-07-16 Thread Ronald Oussoren
Changes by Ronald Oussoren ronaldousso...@mac.com: -- nosy: +ronaldoussoren ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24621 ___ ___

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Ben Finney
Zachary Ware zachary.ware+pyl...@gmail.com writes: On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Fine by me. What is the mapping API that needs to be implemented though? Have a look at collections.MutableMapping. Thank you, that's great! I hadn't realised

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Mark Lawrence
On 16/07/2015 07:37, Ben Finney wrote: Ethan Furman et...@stoneleaf.us writes: On 07/15/2015 10:53 PM, Ben Finney wrote: Are those the ‘__contains__’, ‘__getitem__’ methods? What actually is the API of a mapping type, that would need to be customised for this application? The problem is

[issue24632] Improve documentation about __main__.py

2015-07-16 Thread Davide Rizzo
Davide Rizzo added the comment: As far as I understand, assuming dir/ contains a __main__.py file $ python dir is equivalent to $ python dir/__main__.py in that it's behaviourally nothing more than executing a script in that dir and setting sys.path accordingly. This is the same in Python 2

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Mark Lawrence
On 16/07/2015 08:09, Mark Lawrence wrote: On 16/07/2015 07:37, Ben Finney wrote: Ethan Furman et...@stoneleaf.us writes: On 07/15/2015 10:53 PM, Ben Finney wrote: Are those the ‘__contains__’, ‘__getitem__’ methods? What actually is the API of a mapping type, that would need to be customised

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Antoon Pardon
On 07/16/2015 12:43 AM, Gregory Ewing wrote: Antoon Pardon wrote: But it doesn't need to be all or nothing. How about the following possibility. When the runtime detects a serie of tail calls, it will keep the bottom three and the top three backtrace records of the serie. Whatever value

Re: Keypress Input

2015-07-16 Thread Terry Reedy
On 7/16/2015 12:30 AM, Michael Torrie wrote: On 07/15/2015 07:03 PM, Rick Johnson wrote: too much to quote I think you've missed the whole point of the OP's project. He doesn't want to make a GUI. He simply wants to have his program do something like blink an LED when someone presses a big

RE: Where is pyvenv.py in new Python3.4 environment on CentOS7?

2015-07-16 Thread KARR, DAVID
-Original Message- From: Python-list [mailto:python-list- bounces+dk068x=att@python.org] On Behalf Of Mark Lawrence Sent: Wednesday, July 15, 2015 3:23 PM To: python-list@python.org Subject: Re: Where is pyvenv.py in new Python3.4 environment on CentOS7? On 15/07/2015 22:54,

[issue24621] zipfile.BadZipFile: File is not a zip file

2015-07-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: unzip can't proceed this file too. $ unzip -v not_working.zip Archive: not_working.zip End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the

Re: Mapping, with sequence as key, wildcard and subsequence matching

2015-07-16 Thread Mark Lawrence
On 16/07/2015 08:11, Ben Finney wrote: Zachary Ware zachary.ware+pyl...@gmail.com writes: On Thu, Jul 16, 2015 at 1:31 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Fine by me. What is the mapping API that needs to be implemented though? Have a look at collections.MutableMapping. Thank

Re: A new module for performing tail-call elimination

2015-07-16 Thread Alain Ketterlin
Antoon Pardon antoon.par...@rece.vub.ac.be writes: On 07/13/2015 05:44 PM, Th. Baruchel wrote: Hi, after having spent much time thinking about tail-call elimination in Python (see for instance http://baruchel.github.io/blog/ ), I finally decided to write a module for that. You may find it at:

[issue24642] Will there be an MSI installer?

2015-07-16 Thread Matthew Barnett
Matthew Barnett added the comment: There's an executable installer; it's a .exe instead of a .msi. -- nosy: +mrabarnett ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24642 ___

Re: A new module for performing tail-call elimination

2015-07-16 Thread Antoon Pardon
On 07/16/2015 01:11 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 8:41 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Fixing the obvious mistake (failing to return anything) leads to the next mistake. When all you have is a hammer, everything looks like a nail. def even(n):

Re: A new module for performing tail-call elimination

2015-07-16 Thread Jeremy Sanders
Robin Becker wrote: I believe the classic answer is Ackermann's function http://demonstrations.wolfram.com/RecursionInTheAckermannFunction/ which is said to be not primitive recursive ie cannot be unwound into loops; not sure whether that implies it has to be recursively defined or can

Re: A new module for performing tail-call elimination

2015-07-16 Thread Chris Angelico
On Thu, Jul 16, 2015 at 11:35 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Of course they could be rather trivially reimplemented. They would also become rather ugly and less easy to comprehend. Here is one way to do the odd, even example. def even(n): return odd_even('even',

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread James Salter
New submission from James Salter: For python 3.5, PC/pyconfig.h contains the following for vs2015 support: /* VS 2015 defines these names with a leading underscore */ #if _MSC_VER = 1900 #define timezone _timezone #define daylight _daylight #define tzname _tzname #endif This breaks any python

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Chris Angelico
On Thu, Jul 16, 2015 at 11:56 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: On 07/16/2015 01:45 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 5:31 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: I would say, that someone should get over himself. Traceback are not the only

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread Zachary Ware
Zachary Ware added the comment: I suppose we'll have to resort to #ifndef _Py_timezone #if _MSC_VER = 1900 #define _Py_timezone _timezone #else #define _Py_timezone timezone #endif #endif ... -- components: +Build, Windows -Extension Modules nosy: +paul.moore, steve.dower, tim.golden,

Re: A new module for performing tail-call elimination

2015-07-16 Thread Antoon Pardon
On 07/16/2015 03:47 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 11:35 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Any collection of functions that tail calls each other can rather trivially be turned into a state machine like the above. You can just paste in the code of the

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Antoon Pardon
On 07/16/2015 04:00 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 11:56 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Fine, I should have been more clear. The stack trace as it is generally produced on stderr after an uncought exception, doesn't contain the values of the

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Antoon Pardon
On 07/16/2015 01:45 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 5:31 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: I would say, that someone should get over himself. Traceback are not the only or even the most useful tool for debugging code. The current stack trace doesn't

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread Steve Dower
Steve Dower added the comment: Or we could define _timezone on those platforms that don't have the underscore. I'm not hugely fussed either way. We need to fix this though. -- ___ Python tracker rep...@bugs.python.org

Re: A new module for performing tail-call elimination

2015-07-16 Thread Chris Angelico
On Fri, Jul 17, 2015 at 12:21 AM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: My point was that I have yet to see anything that demands TCO and can't be algorithmically improved. And how is this point relevant? Why should I care about what you have not seen? Will it give me new insights

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread STINNER Victor
STINNER Victor added the comment: Can't we move the #define only in .c files where they are needed? Or in a private header (not included by Python.h)? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24643

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread Steve Dower
Steve Dower added the comment: That's probably an option, though it would break extensions that use `timezone` expecting it to work. But it seems like any change is going to cause that. I prefer defining _Py_timezone, since at least we can offer something that is portable for all Python 3.5

Re: A new module for performing tail-call elimination

2015-07-16 Thread Antoon Pardon
On 07/16/2015 04:27 PM, Chris Angelico wrote: On Fri, Jul 17, 2015 at 12:21 AM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: My point was that I have yet to see anything that demands TCO and can't be algorithmically improved. And how is this point relevant? Why should I care about what

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Chris Angelico
On Fri, Jul 17, 2015 at 2:50 AM, Joonas Liik liik.joo...@gmail.com wrote: Wouldn't it be possible to have like a dynamically sized stack so that you can grow it endlessly with some acceptable overhead.. That would pretty much take care of the stack-overflow argument without many painful side

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Ethan Furman
On 07/16/2015 09:43 AM, Chris Angelico wrote: True. That said, though, it's not a justification for dropping stack frames; even in the form that's printed to stderr, there is immense value in them. It may be possible to explicitly drop frames that a programmer believes won't be useful, but a

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Chris Angelico
On Thu, Jul 16, 2015 at 5:31 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: On 07/16/2015 12:43 AM, Gregory Ewing wrote: Antoon Pardon wrote: But it doesn't need to be all or nothing. How about the following possibility. When the runtime detects a serie of tail calls, it will keep

[ANN] bcolz v0.10.0

2015-07-16 Thread Valentin Haenel
=== Announcing bcolz 0.10.0 === What's new == This is a cleanup-and-refactor release with many internal optimizations and a few bug fixes. For users, the most important improvement is the new-and-shiny context manager for bcolz objects. For example

[issue24644] --help for runnable stdlib modules

2015-07-16 Thread Antony Lee
New submission from Antony Lee: Support for python -mrunnable-stdlib-module [-h|--help] is a bit patchy right now: $ python -mpdb -h usage: pdb.py [-c command] ... pyfile [arg] ... help elided $ python -mpdb --help Traceback (most recent call last): File /usr/lib/python3.4/runpy.py, line

[issue24630] null pointer dereference in `load_newobj_ex`

2015-07-16 Thread Brad Larsen
Brad Larsen added the comment: Yeah, this appears to be fixed along with #24552. -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24630 ___

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Chris Angelico
On Fri, Jul 17, 2015 at 12:32 AM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: On 07/16/2015 04:00 PM, Chris Angelico wrote: On Thu, Jul 16, 2015 at 11:56 PM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: Fine, I should have been more clear. The stack trace as it is generally

[issue23247] Crash in the reset() method of StreamWriter of CJK codecs

2015-07-16 Thread Aaron Hill
Aaron Hill added the comment: I've added a test case to exercise reset() -- Added file: http://bugs.python.org/file39934/fix-multibytecodec-segfault-with-test.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23247

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Joonas Liik
Wouldn't it be possible to have like a dynamically sized stack so that you can grow it endlessly with some acceptable overhead.. That would pretty much take care of the stack-overflow argument without many painful side effects on the semantics at least.. --

Re: A new module for performing tail-call elimination

2015-07-16 Thread Ian Kelly
On Thu, Jul 16, 2015 at 3:28 AM, Robin Becker ro...@reportlab.com wrote: .. The point is, people keep insisting that there are a vast number of algorithms which are best expressed using recursion and which require TCO to be practical, and yet when asked for examples they either

Re: Noob in Python. Problem with fairly simple test case

2015-07-16 Thread Rick Johnson
On Wednesday, July 15, 2015 at 10:45:12 PM UTC-5, Chris Angelico wrote: A GUI is another form of console. And a blindingly obvious association is another form of patronizing! What's next, are you going to tell us that a Volvo is a street-legal Scandinavian version of an armored personal

[issue24645] logging.handlers.QueueHandler should not lock when handling a record

2015-07-16 Thread Justin Bronder
Justin Bronder added the comment: On 16/07/15 20:03 +, R. David Murray wrote: R. David Murray added the comment: Can you expand on the deadlock? Are you saying that the extra locking is causing the deadlock? -- nosy: +r.david.murray, vinay.sajip versions: -Python 3.2,

[issue19918] PureWindowsPath.relative_to() is not case insensitive

2015-07-16 Thread Aaron Meurer
Changes by Aaron Meurer aaron.meu...@continuum.io: -- nosy: +Aaron Meurer ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19918 ___ ___

Re: Keypress Input

2015-07-16 Thread Michael Torrie
On 07/16/2015 11:22 AM, Rick Johnson wrote: On Wednesday, July 15, 2015 at 11:30:40 PM UTC-5, Michael Torrie wrote: On 07/15/2015 07:03 PM, Rick Johnson wrote: too much to quote I think you've missed the whole point of the OP's project. Obviously my reply was not only too much to quote,

Re: Noob in Python. Problem with fairly simple test case

2015-07-16 Thread Emile van Sebille
On Thursday, July 16, 2015 at 3:11:56 PM UTC-5, Chris Angelico wrote: Where's the latest survey results? I think the numbers don't agree with you any more. Not that there's a source for that info, but a quick survey of yahoo results certainly continues to show more v2 activity. --anytime--

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Chris Angelico
On Fri, Jul 17, 2015 at 4:23 AM, Joonas Liik liik.joo...@gmail.com wrote: On 16 July 2015 at 20:49, Chris Angelico ros...@gmail.com wrote: This sounds like a denial-of-service attack. If you can state that no reasonable document will ever have more than 100 levels of nesting, then you can

[issue24645] logging.handlers.QueueHandler should not lock when handling a record

2015-07-16 Thread Justin Bronder
New submission from Justin Bronder: The Queue backing the QueueHandler is already sufficiently locking for thread-safety. This isn't a huge issue, but the QueueHandler is a very nice built-in which could be used to work around a deadlock I've encountered several times. In brief, functions

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread Steve Dower
Steve Dower added the comment: It's not, but #include python.h in any extension will make it available for you, so it's very likely that extensions have simply used it without adding their own conditional compilation for the various interpretations of whether timezone is standard or not. Bit

Re: Noob in Python. Problem with fairly simple test case

2015-07-16 Thread Rick Johnson
On Thursday, July 16, 2015 at 3:11:56 PM UTC-5, Chris Angelico wrote: Where's the latest survey results? I think the numbers don't agree with you any more. What? You think the handful of regulars on this list in any way shape or form somehow represents the multitude of *REAL* python programmers

[issue23601] use small object allocator for dict key storage

2015-07-16 Thread Mark Shannon
Mark Shannon added the comment: +1 from me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23601 ___ ___ Python-bugs-list mailing list

Re: How does a dictionary work exactly?

2015-07-16 Thread Skip Montanaro
On Thu, Jul 16, 2015 at 1:36 PM, yoursurrogate...@gmail.com yoursurrogate...@gmail.com wrote: If I understand correctly, lookup would not be a constant, yes? On the contrary, that's what you desire, nearly constant time execution. To the greatest extent possible, you want the linked lists to be

[issue24646] Python accepts SSL certificate that should be rejected on OSX

2015-07-16 Thread Jussi Pakkanen
New submission from Jussi Pakkanen: Create a dummy certificate and build an ssl context like this: ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) ctx.verify_mode = ssl.CERT_REQUIRED ctx.load_verify_locations(cadata=dummy_certificate) Then try to connect to a public service like this: u =

Re: Noob in Python. Problem with fairly simple test case

2015-07-16 Thread Chris Angelico
On Fri, Jul 17, 2015 at 6:03 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: but a vast majority of the Python community is currently using, and will for many years continue using, Python3.0. Where's the latest survey results? I think the numbers don't agree with you any more. ChrisA --

[issue23247] Crash in the reset() method of StreamWriter of CJK codecs

2015-07-16 Thread Roundup Robot
Roundup Robot added the comment: New changeset 35a6fe0e2b27 by Victor Stinner in branch '3.4': Closes #23247: Fix a crash in the StreamWriter.reset() of CJK codecs https://hg.python.org/cpython/rev/35a6fe0e2b27 -- nosy: +python-dev resolution: - fixed stage: patch review - resolved

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread STINNER Victor
STINNER Victor added the comment: For me, it's not the responsability of python.h to ensure that the timezone symbol is available. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24643 ___

[issue24643] VS 2015 pyconfig.h #define timezone _timezone conflicts with timeb.h

2015-07-16 Thread Steve Dower
Steve Dower added the comment: Agreed. However, I also don't want extensions to stop building because of a change we make. But since that's inevitable here, let's go with Zach's original suggestion and use a name that won't conflict. (IIRC, I originally put the #ifdefs in each file and was

[issue24647] Document argparse.REMAINDER as being equal to ...

2015-07-16 Thread Antony Lee
New submission from Antony Lee: Currently the argparse docs mention the special values +, * and ? by their actual values instead of argparse.{ONE_OR_MORE,ZERO_OR_MORE,OPTIONAL}, but argparse.REMAINDER is mentioned as is. It seems easier to just use its actual value (...) in the docs as well.

[issue24648] Allocation of values array in split dicts should use small object allocator.

2015-07-16 Thread Mark Shannon
New submission from Mark Shannon: Issue 23601 advocates using the small object allocator for dict-keys objects and the results of tests are good. Using the small object allocator for dict value-arrays as well seems like the obvious next step. -- components: Interpreter Core keywords:

Re: A new module for performing tail-call elimination

2015-07-16 Thread Terry Reedy
On 7/16/2015 2:02 PM, Ethan Furman wrote: On 07/16/2015 06:35 AM, Antoon Pardon wrote: Here is one way to do the odd, even example. def even(n): return odd_even('even', n) def odd(n): return odd_even('odd', n) def odd_even(fn, n): while fn is not None: if fn ==

Re: A new module for performing tail-call elimination

2015-07-16 Thread Marko Rauhamaa
Nobody seemed to notice that I just posted a fairly typical tail call function: def setvalue(self, keyseq, value, offset=0): try: next = keyseq[offset] except IndexError:

[issue23601] use small object allocator for dict key storage

2015-07-16 Thread Mark Shannon
Mark Shannon added the comment: Yes, but that shouldn't block this issue. I've opened issue 24648 instead. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23601 ___

Re: Possibly Pythonic Tail Call Optimization (TCO/TRE)

2015-07-16 Thread Ethan Furman
On 07/16/2015 12:14 PM, Joonas Liik wrote: You are giving the programmer a choice between run out of stack and crash and mutilate interpreter internals and crash or zero out the hard drive this is not a real choice.. +1 -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

[issue24645] logging.handlers.QueueHandler should not lock when handling a record

2015-07-16 Thread R. David Murray
R. David Murray added the comment: Can you expand on the deadlock? Are you saying that the extra locking is causing the deadlock? -- nosy: +r.david.murray, vinay.sajip versions: -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org

  1   2   >