Re: [Python-Dev] PEP 468 (Ordered kwargs)

2015-01-27 Thread Armin Rigo
Hi all,

On 24 January 2015 at 11:50, Maciej Fijalkowski fij...@gmail.com wrote:
 I would like to point out that we implemented rhettingers idea in PyPy
 that makes all the dicts ordered by default and we don't have any
 adverse performance effects (in fact, there is quite significant
 memory saving coming from it). The measurments on CPython could be
 different, but in principle OrderedDict can be implemented as
 efficiently as normal dict.

I would like to add that http://bugs.python.org/issue16991 is the same
as today's dicts with an additional doubly-linked list for the order.
I'm unsure why you would do that after the 2012 thread started by
Raymond Hettinger, but anyway, don't conclude from only this that in
the CPython case ordered dictionaries would be slower and bigger.  My
guess is that, with a simple port of what is now in PyPy, they would
not be (but of course no-one can be sure at this point).  Let's say,
if you could imagine that CPython's dictionaries, tomorrow, are always
magically fully ordered, then would it still be a bad idea?

If such a discussion would resurface (soon or one day), and if other
related issues are resolved (like what to do in Jython and
IronPython), and if the conclusion would tentatively turn out
positive... then, provided there would at that point still be no
Raymond-style implementation of dicts, I would volunteer to port
PyPy's one to CPython[1].  As you may have guessed I don't consider
this particularly likely to occur, but it is a standing offer
nevertheless :-)


A bientôt,

Armin.


[1]  Someone could also do such a port for the goal of getting an
alternate `odictobject.c`.  He would be welcome to #pypy to get some
help from the PyPy guys, including me --- but my offer above doesn't
apply in this case.  I want to remove a thorn in the foot of
python-dev discussing about the language; I'm not really interested in
contributing to the `collections.OrderedDict` type.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Glenn Linderman

On 1/27/2015 8:04 AM, Cyd Haselton wrote:

Noted. Will proceed with the 3.x releass.
I had been excited you were working on Android Python until I realized 
you were working on 2.x. I started with Python 3, and have only dabbled 
in 2.x for a couple projects that had unported dependency needs. One of 
them, reportlab, was ported in the last year, and the other is my web 
server CGI ports which is still constrained by a couple libraries, and 
although I think they may have recently been ported, I haven't had time 
to upgrade it. Probably will by April, when I have to ditch my Google 
OpenID login system, because they have abandoned it.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Cyd Haselton
On Mon, Jan 26, 2015 at 2:26 PM, Skip Montanaro
skip.montan...@gmail.com wrote:
 On Mon, Jan 26, 2015 at 12:49 PM, Cyd Haselton chasel...@gmail.com wrote:
 Unfortunately, as I quickly found out,
 Python's built-in help function requires tkinter, which requires
 tcl/tk.

 I'm a little confused. Are you using some sort of freeze system which
 is deciding Tkinter is required? I use help() all the time from the
 interpreter prompt and never get a GUI. IMO you should be able to
 strip out the gui() function (or even just comment out the Tkinter
 import).

 Skip

I'm not using a freeze system, just the python I built from sources. I
may have misread the pydoc and help() documentation online.

Additionally it appears as though some modules were not built with the
correct links to -lc -ldl, even though I added them as dependencies in
Setup and setup.py, as well as in the appropriate env variables.
Importing string, tokenize, operator, inspect...and probably others I
haven't tested...throw the 'undefined reference to dlopen' error.

Looks like I'll need to run make distclean and start over.  Is there
documentation on which modules are built where and how and with which
libraries they are linked?
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Cyd Haselton
On Tue, Jan 27, 2015 at 6:31 AM, Cyd Haselton chasel...@gmail.com wrote:
 On Mon, Jan 26, 2015 at 2:26 PM, Skip Montanaro
 skip.montan...@gmail.com wrote:
 On Mon, Jan 26, 2015 at 12:49 PM, Cyd Haselton chasel...@gmail.com wrote:
 Unfortunately, as I quickly found out,
 Python's built-in help function requires tkinter, which requires
 tcl/tk.

 I'm a little confused. Are you using some sort of freeze system which
 is deciding Tkinter is required? I use help() all the time from the
 interpreter prompt and never get a GUI. IMO you should be able to
 strip out the gui() function (or even just comment out the Tkinter
 import).

 Skip

 I'm not using a freeze system, just the python I built from sources. I
 may have misread the pydoc and help() documentation online.

 Additionally it appears as though some modules were not built with the
 correct links to -lc -ldl, even though I added them as dependencies in
 Setup and setup.py, as well as in the appropriate env variables.
 Importing string, tokenize, operator, inspect...and probably others I
 haven't tested...throw the 'undefined reference to dlopen' error.

 Looks like I'll need to run make distclean and start over.  Is there
 documentation on which modules are built where and how and with which
 libraries they are linked?

A quick FYI: The decision to build 2.7.8 (instead of 3.x) on Android
was made after reading this article:
https://wiki.python.org/moin/Python2orPython3
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Skip Montanaro
On Tue, Jan 27, 2015 at 6:46 AM, Cyd Haselton chasel...@gmail.com wrote:
 A quick FYI: The decision to build 2.7.8 (instead of 3.x) on Android
 was made after reading this article:
 https://wiki.python.org/moin/Python2orPython3

What in that document convinced you to port to Python 2 instead of
Python 3? That page is intended for people deciding which version of
the language to use for their work. I would think as someone trying to
port to a new platform your criteria would be different. Also, note
that the above page was last updated in April 2014. Look at the info
for that page:

https://wiki.python.org/moin/Python2orPython3?action=info

and you'll see there was probably nothing of substance added to that
page in over a year.

Right at the very top of that page, I read:

Short version: Python 2.x is legacy, Python 3.x is the present and
future of the language

I would think that would be enough to convince you to use Python 3.x
as your starting point. I say this as someone who, in his day-to-day
work uses Python 2.7 exclusively, doesn't expect his employer to ever
convert to Python 3, and has never done much more with Python 3 than
build it. With all that, if I was going to attempt a port of Python to
a new platform, I would still choose to port Python 3.

Skip
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Cyd Haselton
On Mon, Jan 26, 2015 at 2:25 PM, Zachary Ware
zachary.ware+py...@gmail.com wrote:
 On Mon, Jan 26, 2015 at 12:49 PM, Cyd Haselton chasel...@gmail.com wrote:
 Hello,
 I've finally managed to build a (somewhat) working Python port for the
 Android tablet I'm using.  Unfortunately, as I quickly found out,
 Python's built-in help function requires tkinter, which requires
 tcl/tk.

 What version of Python are you building, and how did you call help
 that it seems to want to use tkinter?  The pydoc GUI was removed from
 the 3.x series long ago, and should only be activated in 2.7 if you
 call it as 'pydoc -g ...' from the command line (or use pydoc.gui()
 directly).

 --
 Zach

I'm using version 2.7.8. I'm calling help() from within the python interpreter.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Cyd Haselton
On Tue, Jan 27, 2015 at 2:45 PM, Glenn Linderman v+pyt...@g.nevcal.com wrote:
 On 1/27/2015 8:04 AM, Cyd Haselton wrote:

 Noted. Will proceed with the 3.x releass.

 I had been excited you were working on Android Python until I realized you
 were working on 2.x. I started with Python 3, and have only dabbled in 2.x
 for a couple projects that had unported dependency needs. One of them,
 reportlab, was ported in the last year, and the other is my web server CGI
 ports which is still constrained by a couple libraries, and although I think
 they may have recently been ported, I haven't had time to upgrade it.
 Probably will by April, when I have to ditch my Google OpenID login system,
 because they have abandoned it.

Well, you can start being cautiously excited again now that I'm
working on the 3.4.2 release.

I use cautiously for several reasons...chief among them being the
severely limited Android libc.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] PEP 468 (Ordered kwargs)

2015-01-27 Thread Gregory P. Smith
On Tue Jan 27 2015 at 2:13:08 PM Armin Rigo ar...@tunes.org wrote:

 Hi all,

 On 24 January 2015 at 11:50, Maciej Fijalkowski fij...@gmail.com wrote:
  I would like to point out that we implemented rhettingers idea in PyPy
  that makes all the dicts ordered by default and we don't have any
  adverse performance effects (in fact, there is quite significant
  memory saving coming from it). The measurments on CPython could be
  different, but in principle OrderedDict can be implemented as
  efficiently as normal dict.

 I would like to add that http://bugs.python.org/issue16991 is the same
 as today's dicts with an additional doubly-linked list for the order.
 I'm unsure why you would do that after the 2012 thread started by
 Raymond Hettinger, but anyway, don't conclude from only this that in
 the CPython case ordered dictionaries would be slower and bigger.  My
 guess is that, with a simple port of what is now in PyPy, they would
 not be (but of course no-one can be sure at this point).  Let's say,
 if you could imagine that CPython's dictionaries, tomorrow, are always
 magically fully ordered, then would it still be a bad idea?


It is a potentially bad idea if order is the default behavior of iteration,
items(), keys() and values(). Ideally order should only be exposed when
explicitly asked for to help prevent bugs and mitigate potential
information leaks.

But I'm not sure how big of a deal this actually is. The insertion order
nicely doesn't give away anything related to the hash seed used for hash
randomization which is a nice bonus over today's implementation (and 2.7 
3.3's very poor hash randomization implementation).

Experience cleaning up our huge code base at work to turn on hash
randomization by default a couple years ago has shown that people depend on
iteration order in code often without intending to. This often leads to
latent bugs. Keep iteration order unstable by default and you prevent
people from doing that. Make people request an ordered or stable iteration
when their code explicitly needs it.

If such a discussion would resurface (soon or one day), and if other
 related issues are resolved (like what to do in Jython and
 IronPython), and if the conclusion would tentatively turn out
 positive... then, provided there would at that point still be no
 Raymond-style implementation of dicts, I would volunteer to port
 PyPy's one to CPython[1].  As you may have guessed I don't consider
 this particularly likely to occur, but it is a standing offer
 nevertheless :-)


CPython should benefit from it regardless for the memory savings alone.

-gps



 A bientôt,

 Armin.


 [1]  Someone could also do such a port for the goal of getting an
 alternate `odictobject.c`.  He would be welcome to #pypy to get some
 help from the PyPy guys, including me --- but my offer above doesn't
 apply in this case.  I want to remove a thorn in the foot of
 python-dev discussing about the language; I'm not really interested in
 contributing to the `collections.OrderedDict` type.
 ___
 Python-Dev mailing list
 Python-Dev@python.org
 https://mail.python.org/mailman/listinfo/python-dev
 Unsubscribe: https://mail.python.org/mailman/options/python-dev/
 greg%40krypto.org

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Undefined reference to dlopen (was: Pydoc Replacement for Python's help()?)

2015-01-27 Thread Skip Montanaro
On Tue, Jan 27, 2015 at 6:31 AM, Cyd Haselton chasel...@gmail.com wrote:
 Additionally it appears as though some modules were not built with the
 correct links to -lc -ldl, even though I added them as dependencies in
 Setup and setup.py, as well as in the appropriate env variables.
 Importing string, tokenize, operator, inspect...and probably others I
 haven't tested...throw the 'undefined reference to dlopen' error.

Is this another topic? If so, please start another thread. People
glancing at subjects
won't recognize that you're now tackling a different problem.

The modules you mention here (as well as pydoc) are all pure Python modules.
I don't think any of them would have directly triggered a dlopen error. Do you
have a traceback?

Skip
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Undefined reference to dlopen (was: Pydoc Replacement for Python's help()?)

2015-01-27 Thread Cyd Haselton
On Tue, Jan 27, 2015 at 6:52 AM, Skip Montanaro
skip.montan...@gmail.com wrote:
 On Tue, Jan 27, 2015 at 6:31 AM, Cyd Haselton chasel...@gmail.com wrote:
 Additionally it appears as though some modules were not built with the
 correct links to -lc -ldl, even though I added them as dependencies in
 Setup and setup.py, as well as in the appropriate env variables.
 Importing string, tokenize, operator, inspect...and probably others I
 haven't tested...throw the 'undefined reference to dlopen' error.

 Is this another topic? If so, please start another thread. People
 glancing at subjects
 won't recognize that you're now tackling a different problem.

 The modules you mention here (as well as pydoc) are all pure Python modules.
 I don't think any of them would have directly triggered a dlopen error. Do you
 have a traceback?

 Skip

Apologies for the confusion; the above was not intended to be another
topic but an explanation of why the help() module failed in my port
and why I believe I'll need to start over.

Basically...between my original email and the one above, I managed to
review the pydoc.py code, test the imports in said code and discover
ones (not tkinter) that were causing errors.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Pydoc Replacement for Python's help()?

2015-01-27 Thread Cyd Haselton
On Tue, Jan 27, 2015 at 9:07 AM, Skip Montanaro
skip.montan...@gmail.com wrote:
 On Tue, Jan 27, 2015 at 6:46 AM, Cyd Haselton chasel...@gmail.com wrote:
 A quick FYI: The decision to build 2.7.8 (instead of 3.x) on Android
 was made after reading this article:
 https://wiki.python.org/moin/Python2orPython3

 What in that document convinced you to port to Python 2 instead of
 Python 3?

Among other things, the points immediately following this part:

However, there are some key issues that may require you to use Python
2 rather than Python 3.

 That page is intended for people deciding which version of
 the language to use for their work. I would think as someone trying to
 port to a new platform your criteria would be different. Also, note
 that the above page was last updated in April 2014. Look at the info
 for that page:

 https://wiki.python.org/moin/Python2orPython3?action=info

 and you'll see there was probably nothing of substance added to that
 page in over a year.

Something to keep in mind is that i'm using an Android tablet for
building and troubleshooting errors...which means webpages have
different layouts.  The change date for the wiki page I referenced is
wy down at the bottom, in extra small, faint type.

I wasn't aware the info was for those using Python.

 Right at the very top of that page, I read:

 Short version: Python 2.x is legacy, Python 3.x is the present and
 future of the language

 I would think that would be enough to convince you to use Python 3.x
 as your starting point.

It was, initially, until I read (most of) the rest of the article

I say this as someone who, in his day-to-day
 work uses Python 2.7 exclusively, doesn't expect his employer to ever
 convert to Python 3, and has never done much more with Python 3 than
 build it. With all that, if I was going to attempt a port of Python to
 a new platform, I would still choose to port Python 3.

 Skip

Noted. Will proceed with the 3.x releass.
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com