Re: Python 3.1 beta 1

2009-05-08 Thread pruebauno
On May 7, 11:57 am, bearophileh...@lycos.com wrote:
 Equality tests between OrderedDict objects are order-sensitive and are 
 implemented as list(od1.items())==list(od2.items()). Equality tests between 
 OrderedDict objects and other Mapping objects are order-insensitive

 very nice idea.


I don't know if somebody else is interested but I wouldn't mind
support to OrderedDict and namedtuple in the csv module:

Have csv.DictReader return an OrderedDict instead of a regular one
(based on the order of the column names in the header line).

Have csv.DictWriter accept an OrderedDict. That would take care of
this:

Note that unlike the DictReader class, the fieldnames parameter of
the DictWriter is not optional. Since Python’s dict objects are not
ordered, there is not enough information available to deduce the order
in which the row should be written to the csvfile.
http://docs.python.org/dev/py3k/library/csv.html#csv.DictWriter

Add a new csv.NamedTupleReader and csv.NamedTupleWriter that work
similar to the DictReader and DictWriter then this snippet (in
examples 
http://docs.python.org/dev/py3k/library/collections.html#collections.namedtuple
):

EmployeeRecord = namedtuple('EmployeeRecord', 'name, age, title,
department, paygrade')
import csv
for emp in map(EmployeeRecord._make, csv.reader(open(employees.csv,
rb))):
print(emp.name, emp.title)

Could be rewritten as:

import csv
for emp in csv.NamedTupleReader(employees.csv):
print(emp.name, emp.title)


Also, is there a way to convert a OrderedDict into a namedtuple? It is
possible to go the other direction using namedtuple._asdict, but I
don't see a _fromdict method.

And thanks Steven and Raymond for the Counter class. Several people
had started to see the common pattern and now we have it in the
stdlib.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-08 Thread pruebauno
On May 7, 6:33 pm, Benjamin Peterson benja...@python.org wrote:
  pruebauno at latinmail.com writes:

  Congratulations!

 Thanks!



  Is it just me or was some nice summary output added to the make
  process? I get a nice list of modules that didn't compile and the ones
  where the library could not be found.

 Are you compiling on a different platform? The nice output has been around 
 for a
 while, bu only on non-Windows platforms.

Not really, I was on AIX. It is probably just me then, probably
because for the first time I see it making it through the whole
process even with the Tkinter libraries missing.
--
http://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.1 beta 1

2009-05-07 Thread Benjamin Peterson
On behalf of the Python development team, I'm thrilled to announce the first and
only beta release of Python 3.1.

Python 3.1 focuses on the stabilization and optimization of features and changes
Python 3.0 introduced.  For example, the new I/O system has been rewritten in C
for speed.  File system APIs that use unicode strings now handle paths with
undecodable bytes in them. [1] Other features include an ordered dictionary
implementation and support for ttk Tile in Tkinter.  For a more extensive list
of changes in 3.1, see http://doc.python.org/dev/py3k/whatsnew/3.1.html or
Misc/NEWS in the Python distribution.

Please note that this is a beta release, and as such is not suitable for
production environments.  We continue to strive for a high degree of quality,
but there are still some known problems and the feature sets have not been
finalized.  This beta is being released to solicit feedback and hopefully
discover bugs, as well as allowing you to determine how changes in 3.1 might
impact you.  If you find things broken or incorrect, please submit a bug report
at

 http://bugs.python.org

For more information and downloadable distributions, see the Python 3.1 website:

 http://www.python.org/download/releases/3.1/

See PEP 375 for release schedule details:

 http://www.python.org/dev/peps/pep-0375/



Enjoy,
-- Benjamin

Benjamin Peterson
benjamin at python.org
Release Manager
(on behalf of the entire python-dev team and 3.1's contributors)
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


Re: [Python-Dev] [RELEASED] Python 3.1 beta 1

2009-05-07 Thread Daniel Fetchinson
 On behalf of the Python development team, I'm thrilled to announce the first
 and
 only beta release of Python 3.1.
..
 Other features include an ordered dictionary implementation

Are there plans for backporting this to python 2.x just as
multiprocessing has been?

I know that there are several ordered dictionary implementations for
2.x but they are all a little bit different from the one going into
3.1, hence my question.

Cheers,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASED] Python 3.1 beta 1

2009-05-07 Thread Scott David Daniels

Daniel Fetchinson wrote:

Other features include an ordered dictionary implementation


Are there plans for backporting this to python 2.x just as
multiprocessing has been?


Why not grab the 3.1 code and do it yourself for your 2.X's?
It should be far less work than attempting something as
fidgety as multiprocessing.

--Scott David Daniels
scott.dani...@acm.org

--
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-Dev] [RELEASED] Python 3.1 beta 1

2009-05-07 Thread Jesse Noller
On Thu, May 7, 2009 at 9:12 AM, Scott David Daniels
scott.dani...@acm.org wrote:
 Daniel Fetchinson wrote:

 Other features include an ordered dictionary implementation

 Are there plans for backporting this to python 2.x just as
 multiprocessing has been?

 Why not grab the 3.1 code and do it yourself for your 2.X's?
 It should be far less work than attempting something as
 fidgety as multiprocessing.

 --Scott David Daniels
 scott.dani...@acm.org

Don't worry, we gave multiprocessing some ADHD meds :)
--
http://mail.python.org/mailman/listinfo/python-list


Re: [RELEASED] Python 3.1 beta 1

2009-05-07 Thread CTO
On May 7, 9:12 am, Scott David Daniels scott.dani...@acm.org wrote:
 Daniel Fetchinson wrote:
  Other features include an ordered dictionary implementation

  Are there plans for backporting this to python 2.x just as
  multiprocessing has been?

 Why not grab the 3.1 code and do it yourself for your 2.X's?
 It should be far less work than attempting something as
 fidgety as multiprocessing.

 --Scott David Daniels
 scott.dani...@acm.org

If OrderedDict winds up being backported, will you include it
in 2.x?

Geremy Condra

--
http://mail.python.org/mailman/listinfo/python-list


Re: [RELEASED] Python 3.1 beta 1

2009-05-07 Thread Scott David Daniels

CTO wrote:

...
If OrderedDict winds up being backported, will you include it
in 2.x?


I see it in the 2.7 sources.

--Scott David Daniels
scott.dani...@acm.org
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-07 Thread bearophileHUGS
I appreciate the tables Infinite Iterators and Iterators
terminating on the shortest input sequence at the top of the
itertools module, they are quite handy. I'd like to see similar
summary tables at the top of other docs pages too (such pages are
often quite long), for example the collections docs page.


collections.Counter and collections.OrderedDict: very nice and useful.
Is the order inside OrderedDict kept with a double linked list of the
items?


Counter.most_common([n]): a good idea.


If I need a dictionary that is both ordered and has a default too I
can't combine their qualities (but I can use the __missing__(key)
hook).


Equality tests between OrderedDict objects are order-sensitive and are 
implemented as list(od1.items())==list(od2.items()). Equality tests between 
OrderedDict objects and other Mapping objects are order-insensitive

very nice idea.


The OrderedDict constructor and update() method both accept keyword arguments, 
but their order is lost because Python's function call semantics pass-in 
keyword arguments using a regular unordered dictionary.

This is unfortunate :-(
Well, I'd like function call semantics pass-in keyword arguments to
use OrderedDicts then... :-)


Several mathematical operations are provided for combining Counter objects to 
produce multisets

Very nice.


itertools.count(): when increments are non-integer I hope the results
are computed with a multiplication instead an interated sum, to
increase precision.


Issue 4688 and the work by Antoine Pitrou: interesting GC
optimization. The performance difference of the BinaryTrees benchmark
is big.

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.1 beta 1

2009-05-07 Thread Benjamin Peterson
On behalf of the Python development team, I'm thrilled to announce the first and
only beta release of Python 3.1.

Python 3.1 focuses on the stabilization and optimization of features and changes
Python 3.0 introduced.  For example, the new I/O system has been rewritten in C
for speed.  File system APIs that use unicode strings now handle paths with
undecodable bytes in them. [1] Other features include an ordered dictionary
implementation and support for ttk Tile in Tkinter.  For a more extensive list
of changes in 3.1, see http://doc.python.org/dev/py3k/whatsnew/3.1.html or
Misc/NEWS in the Python distribution.

Please note that this is a beta release, and as such is not suitable for
production environments.  We continue to strive for a high degree of quality,
but there are still some known problems and the feature sets have not been
finalized.  This beta is being released to solicit feedback and hopefully
discover bugs, as well as allowing you to determine how changes in 3.1 might
impact you.  If you find things broken or incorrect, please submit a bug report
at

 http://bugs.python.org

For more information and downloadable distributions, see the Python 3.1 website:

 http://www.python.org/download/releases/3.1/

See PEP 375 for release schedule details:

 http://www.python.org/dev/peps/pep-0375/



Enjoy,
-- Benjamin

Benjamin Peterson
benjamin at python.org
Release Manager
(on behalf of the entire python-dev team and 3.1's contributors)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-07 Thread pruebauno
On May 6, 9:32 pm, Benjamin Peterson benja...@python.org wrote:
 On behalf of the Python development team, I'm thrilled to announce the first 
 and
 only beta release of Python 3.1.

 Python 3.1 focuses on the stabilization and optimization of features and 
 changes
 Python 3.0 introduced.  For example, the new I/O system has been rewritten in 
 C
 for speed.  File system APIs that use unicode strings now handle paths with
 undecodable bytes in them. [1] Other features include an ordered dictionary
 implementation and support for ttk Tile in Tkinter.  For a more extensive list
 of changes in 3.1, seehttp://doc.python.org/dev/py3k/whatsnew/3.1.htmlor
 Misc/NEWS in the Python distribution.

 Please note that this is a beta release, and as such is not suitable for
 production environments.  We continue to strive for a high degree of quality,
 but there are still some known problems and the feature sets have not been
 finalized.  This beta is being released to solicit feedback and hopefully
 discover bugs, as well as allowing you to determine how changes in 3.1 might
 impact you.  If you find things broken or incorrect, please submit a bug 
 report
 at

    http://bugs.python.org

 For more information and downloadable distributions, see the Python 3.1 
 website:

    http://www.python.org/download/releases/3.1/

 See PEP 375 for release schedule details:

    http://www.python.org/dev/peps/pep-0375/

 Enjoy,
 -- Benjamin

 Benjamin Peterson
 benjamin at python.org
 Release Manager
 (on behalf of the entire python-dev team and 3.1's contributors)


Congratulations!

Is it just me or was some nice summary output added to the make
process? I get a nice list of modules that didn't compile and the ones
where the library could not be found.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-07 Thread Terry Reedy

bearophileh...@lycos.com wrote:


Is the order inside OrderedDict kept with a double linked list of the
items?


That is one of the things Raymond tried.  Check the code for what he 
settled on for the Python version.  I believe he thinks the best C 
implementation might be different from the best Python version.



The OrderedDict constructor and update() method both accept

 keyword arguments, but their order is lost because Python's
 function call semantics pass-in keyword arguments using a regular
 unordered dictionary.


This is unfortunate :-(
Well, I'd like function call semantics pass-in keyword arguments to
use OrderedDicts then... :-)


This possibility has been discussed on pydev.
It would require a sufficiently fast C implementation.

tjr

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-07 Thread bearophileHUGS
Terry Reedy:
bearophile:
  Well, I'd like function call semantics pass-in keyword arguments to
  use OrderedDicts then... :-)

[...]
 It would require a sufficiently fast C implementation.

Right.
Such dict is usually small, so if people want it ordered, it may be
better to just use an array of name-value structs instead of a dict or
ordered dict. Iterating on a 10-pair array is fast on modern CPUs.

Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-07 Thread Benjamin Peterson
 pruebauno at latinmail.com writes:
 Congratulations!

Thanks!

 
 Is it just me or was some nice summary output added to the make
 process? I get a nice list of modules that didn't compile and the ones
 where the library could not be found.

Are you compiling on a different platform? The nice output has been around for a
while, bu only on non-Windows platforms.




--
http://mail.python.org/mailman/listinfo/python-list


Re: Python 3.1 beta 1

2009-05-07 Thread Benjamin Peterson
 bearophileHUGS at lycos.com writes:
 
 collections.Counter and collections.OrderedDict: very nice and useful.
 Is the order inside OrderedDict kept with a double linked list of the
 items?
 
There's a doubly-linked list containing the values. Another dictionary maps keys
to the list.



--
http://mail.python.org/mailman/listinfo/python-list


[RELEASED] Python 3.1 beta 1

2009-05-06 Thread Benjamin Peterson
On behalf of the Python development team, I'm thrilled to announce the first and
only beta release of Python 3.1.

Python 3.1 focuses on the stabilization and optimization of features and changes
Python 3.0 introduced.  For example, the new I/O system has been rewritten in C
for speed.  File system APIs that use unicode strings now handle paths with
undecodable bytes in them. [1] Other features include an ordered dictionary
implementation and support for ttk Tile in Tkinter.  For a more extensive list
of changes in 3.1, see http://doc.python.org/dev/py3k/whatsnew/3.1.html or
Misc/NEWS in the Python distribution.

Please note that this is a beta release, and as such is not suitable for
production environments.  We continue to strive for a high degree of quality,
but there are still some known problems and the feature sets have not been
finalized.  This beta is being released to solicit feedback and hopefully
discover bugs, as well as allowing you to determine how changes in 3.1 might
impact you.  If you find things broken or incorrect, please submit a bug report
at

http://bugs.python.org

For more information and downloadable distributions, see the Python 3.1 website:

http://www.python.org/download/releases/3.1/

See PEP 375 for release schedule details:

http://www.python.org/dev/peps/pep-0375/



Enjoy,
-- Benjamin

Benjamin Peterson
benjamin at python.org
Release Manager
(on behalf of the entire python-dev team and 3.1's contributors)
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


[RELEASED] Python 3.1 beta 1

2009-05-06 Thread Benjamin Peterson
On behalf of the Python development team, I'm thrilled to announce the first and
only beta release of Python 3.1.

Python 3.1 focuses on the stabilization and optimization of features and changes
Python 3.0 introduced.  For example, the new I/O system has been rewritten in C
for speed.  File system APIs that use unicode strings now handle paths with
undecodable bytes in them. [1] Other features include an ordered dictionary
implementation and support for ttk Tile in Tkinter.  For a more extensive list
of changes in 3.1, see http://doc.python.org/dev/py3k/whatsnew/3.1.html or
Misc/NEWS in the Python distribution.

Please note that this is a beta release, and as such is not suitable for
production environments.  We continue to strive for a high degree of quality,
but there are still some known problems and the feature sets have not been
finalized.  This beta is being released to solicit feedback and hopefully
discover bugs, as well as allowing you to determine how changes in 3.1 might
impact you.  If you find things broken or incorrect, please submit a bug report
at

http://bugs.python.org

For more information and downloadable distributions, see the Python 3.1 website:

http://www.python.org/download/releases/3.1/

See PEP 375 for release schedule details:

http://www.python.org/dev/peps/pep-0375/



Enjoy,
-- Benjamin

Benjamin Peterson
benjamin at python.org
Release Manager
(on behalf of the entire python-dev team and 3.1's contributors)
--
http://mail.python.org/mailman/listinfo/python-list