Re: [Python-Dev] A "record" type (was Re: Py2.6 ideas)
Larry Hastings <[EMAIL PROTECTED]> wrote:
>
> Josiah Carlson wrote:
> > one thing to note with your method - you can't guarantee the order
> > of the attributes as they are being displayed.
> >
> Actually, my record type *can*; see the hack using the __names__ field.
> It won't preserve that order during iteration--but it's only a prototype
> so far, and it could be fixed if there was interest.
Actually, it *can't*. The ordering of the dict produced by the **kwargs
arguments is exactly same as a regular dictionary.
>>> def foo(**k):
... return k
...
>>> foo(b=1, a=2)
{'a': 2, 'b': 1}
>>> foo(hello=1, world=2)
{'world': 2, 'hello': 1}
After construction you can preserve the order it has, but you've already
lost the order provided in the call, so the order you get is arbitrarily
defined by implementation details of dictionaries and hash(str).
- Josiah
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Py2.6 ideas
Michele Simionato gmail.com> writes:
> Finally I did some timing of code like this::
>
> from itertools import imap
> Point = namedtuple('Point x y'.split())
>
> lst = [(i, i*i) for i in range(500)]
>
> def with_imap():
> for _ in imap(Point, lst):
> pass
>
> def with_star():
> for _ in (Point(*t) for t in lst):
> pass
>
> and as expected the performances are worse with the * notation
BTW, I take back this point. It is true that the generation expression
is slower, but the direct equivalent of imap is starmap and using
that I don't see a significant difference in execution times. So it seems that
starmap is smart enough to avoid unnecessary tuple unpacking (as you
probably know ;-). I still don't like for a subclass to have an incompatible
signature with the parent class, but that's just me.
Michele Simionato
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Welcome to the "Python-Dev" mailing list
Hello Steve Holden, I'm already registered and I want to be a list administrator, where to go? How to do this? I need to have my own mail address to administer my mailing list, do you understand me? I've been trying to do this and I'm lost, I don't know where exactly to go, to which address to be registered for this purposes, what are the steps, I have already read averything, please help me!! I wish I would have a proper guide this time and sorry to bother you. my regards, Juan Carlos - Original Message - From: "Steve Holden" <[EMAIL PROTECTED]> To: Cc: Sent: Tuesday, February 20, 2007 10:00 AM Subject: Re: [Python-Dev] Welcome to the "Python-Dev" mailing list > Juan Carlos: > > Please note that the python-dev list is for the developers of the Python > language, rather than for Python application developer, so your query > isn't really appropriate for this list. > > I would suggest that you read the mailman license carefully, as it will > tell you what you are allowed to do with the software. Since Mailman is > distributed under the GPL it is likely you can do all the things you > want to. If you have any further queries then there is a Mailman mailing > list to which you should refer. Please see > > http://www.gnu.org/software/mailman/ > > for further details. Good luck with your project. > > regards > Steve > > Juan Carlos Suarez wrote: >> >> *Good morning*, thanks a lot for your answer, I confirmed by this means >> my subscription. >> What *I really wish and need* is to be able to use Mailman as a freely >> distributer , as a distributer of my own mailing lists ,as a mailing list >> manager , to be able to send my mails by Mailman and to be able to open >> my own mail address. >> How should I do this. I need your instructions and help. >> I'm waiting for your answer soon >> Thanks, my regards, *Juan Carlos Suarez* >> >> >> >> >> You wrote: >> Welcome to the [email protected] mailing list! If you are a new >> subscriber, please take the time to introduce yourself briefly in your >> first post. It is appreciated if you lurk around for a while before >> posting! :-) >> >> Additional information on Python's development process can be found in >> the Python Developer's Guide: >> >> http://www.python.org/dev/ >> >> To post to this list, send your email to: >> >> [email protected] >> >> General information about the mailing list is at: >> >> http://mail.python.org/mailman/listinfo/python-dev >> >> If you ever want to unsubscribe or change your options (eg, switch to >> or from digest mode, change your password, etc.), visit your >> subscription page at: >> >> >> http://mail.python.org/mailman/options/python-dev/juancarlosuarez%40ciudad.com.ar >> >> >> You can also make such adjustments via email by sending a message to: >> >> [EMAIL PROTECTED] >> >> with the word `help' in the subject or body (don't include the >> quotes), and you will get back a message with instructions. >> >> You must know your password to change your options (including changing >> the password, itself) or to unsubscribe. It is: >> >> casandra07 >> >> Normally, Mailman will remind you of your python.org mailing list >> passwords once every month, although you can disable this if you >> prefer. This reminder will also include instructions on how to >> unsubscribe or change your account options. There is also a button on >> your options page that will email your current password to you. >> >> >> >> >> ___ >> Python-Dev mailing list >> [email protected] >> http://mail.python.org/mailman/listinfo/python-dev >> Unsubscribe: >> http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org > > > -- > Steve Holden +44 150 684 7255 +1 800 494 3119 > Holden Web LLC/Ltd http://www.holdenweb.com > Skype: holdenweb http://del.icio.us/steve.holden > Blog of Note: http://holdenweb.blogspot.com > See you at PyCon? http://us.pycon.org/TX2007 > > ___ > Python-Dev mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/juancarlosuarez%40ciudad.com.ar > > ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Py_ssize_t
Guido van Rossum wrote: > My suspicion is that building Python for an 64-bit address space is > still a somewhat academic exercise. arbitrary 64-bit systems, perhaps. the first Python system I ever built was deployed on an LP64 system back in 1995. it's still running, and is still being maintained. ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Making builtins more efficient
On Tue, 2007-02-20 at 07:48 -0800, Guido van Rossum wrote: > If this is not a replay of an old message, please move the discussion > to python-ideas. It's a modified version of an old idea, so I wasn't sure where to post it since previously it was discussed here. I'll look into python-ideas. -- --- | Steven Elliott | [EMAIL PROTECTED] | --- ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Py_ssize_t
Fredrik Lundh schrieb: >> My suspicion is that building Python for an 64-bit address space is >> still a somewhat academic exercise. > > arbitrary 64-bit systems, perhaps. the first Python system I ever built was > deployed > on an LP64 system back in 1995. it's still running, and is still being > maintained. I can see that you would run a 64-bit version of Python on a system where no 32-bit mode is available, or where certain libraries are only available for 64-bit mode, or where the performance of the 32-bit mode is inadequate. However, I would expect that you "normally" cannot exercise the "large collections" feature of Python 2.5 on such an installation, because you have not enough memory (in particular if the system was built in 1995). Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] A "record" type (was Re: Py2.6 ideas)
On 2/20/07, Steven Bethard <[EMAIL PROTECTED]> wrote:
> Declare a simple class for your type and you're ready to go::
>
> >>> class Point(Record):
> ... __slots__ = 'x', 'y'
> ...
> >>> Point(3, 4)
> Point(x=3, y=4)
Here's a brief comparison between Raymond's NamedTuple factory
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/500261) and
my Record class
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502237).
Given a ``records`` module containing the recipes and the following
code::
class RecordPoint(Record):
__slots__ = 'x', 'y'
NamedTuplePoint = NamedTuple('NamedTuplePoint x y')
I got the following times from timeit::
$ python -m timeit -s "import records; Point = records.RecordPoint"
"Point(1, 2)"
100 loops, best of 3: 0.856 usec per loop
$ python -m timeit -s "import records; Point =
records.NamedTuplePoint" "Point(1, 2)"
100 loops, best of 3: 1.59 usec per loop
$ python -m timeit -s "import records; point = records.RecordPoint(1,
2)" "point.x; point.y"
1000 loops, best of 3: 0.209 usec per loop
$ python -m timeit -s "import records; point =
records.NamedTuplePoint(1, 2)" "point.x; point.y"
100 loops, best of 3: 0.551 usec per loop
$ python -m timeit -s "import records; point = records.RecordPoint(1,
2)" "x, y = point"
100 loops, best of 3: 1.47 usec per loop
$ python -m timeit -s "import records; point =
records.NamedTuplePoint(1, 2)" "x, y = point"
1000 loops, best of 3: 0.155 usec per loop
In short, for object construction and attribute access, the Record
class is faster (because __init__ is a simple list of assignments and
attribute access is through C-level slots). For unpacking and
iteration, the NamedTuple factory is faster (because it's using the
C-level tuple iteration instead of a Python-level generator).
STeVe
--
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
--- Bucky Katt, Get Fuzzy
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Welcome to the "Python-Dev" mailing list
As Steve said, this is the wrong place to be asking for help about this. We have *nothing* to do with mailing lists or Mailman. Please read Steve's email again and follow the link in it. The people on this list cannot help you with what you are asking for. -Brett On 2/21/07, Juan Carlos Suarez <[EMAIL PROTECTED]> wrote: > Hello Steve Holden, I'm already registered and I want to be a list > administrator, where to go? How to do this? I need to have my own mail > address to administer my mailing list, do you understand me? I've been > trying to do this and I'm lost, I don't know where exactly to go, to which > address to be registered for this purposes, what are the steps, I have > already read averything, please help me!! > I wish I would have a proper guide this time and sorry to bother you. > my regards, Juan Carlos > - Original Message - > From: "Steve Holden" <[EMAIL PROTECTED]> > To: > Cc: > Sent: Tuesday, February 20, 2007 10:00 AM > Subject: Re: [Python-Dev] Welcome to the "Python-Dev" mailing list > > > > Juan Carlos: > > > > Please note that the python-dev list is for the developers of the Python > > language, rather than for Python application developer, so your query > > isn't really appropriate for this list. > > > > I would suggest that you read the mailman license carefully, as it will > > tell you what you are allowed to do with the software. Since Mailman is > > distributed under the GPL it is likely you can do all the things you > > want to. If you have any further queries then there is a Mailman mailing > > list to which you should refer. Please see > > > > http://www.gnu.org/software/mailman/ > > > > for further details. Good luck with your project. > > > > regards > > Steve > > > > Juan Carlos Suarez wrote: > >> > >> *Good morning*, thanks a lot for your answer, I confirmed by this means > >> my subscription. > >> What *I really wish and need* is to be able to use Mailman as a freely > >> distributer , as a distributer of my own mailing lists ,as a mailing list > >> manager , to be able to send my mails by Mailman and to be able to open > >> my own mail address. > >> How should I do this. I need your instructions and help. > >> I'm waiting for your answer soon > >> Thanks, my regards, *Juan Carlos Suarez* > >> > >> > >> > >> > >> You wrote: > >> Welcome to the [email protected] mailing list! If you are a new > >> subscriber, please take the time to introduce yourself briefly in your > >> first post. It is appreciated if you lurk around for a while before > >> posting! :-) > >> > >> Additional information on Python's development process can be found in > >> the Python Developer's Guide: > >> > >> http://www.python.org/dev/ > >> > >> To post to this list, send your email to: > >> > >> [email protected] > >> > >> General information about the mailing list is at: > >> > >> http://mail.python.org/mailman/listinfo/python-dev > >> > >> If you ever want to unsubscribe or change your options (eg, switch to > >> or from digest mode, change your password, etc.), visit your > >> subscription page at: > >> > >> > >> http://mail.python.org/mailman/options/python-dev/juancarlosuarez%40ciudad.com.ar > >> > >> > >> You can also make such adjustments via email by sending a message to: > >> > >> [EMAIL PROTECTED] > >> > >> with the word `help' in the subject or body (don't include the > >> quotes), and you will get back a message with instructions. > >> > >> You must know your password to change your options (including changing > >> the password, itself) or to unsubscribe. It is: > >> > >> casandra07 > >> > >> Normally, Mailman will remind you of your python.org mailing list > >> passwords once every month, although you can disable this if you > >> prefer. This reminder will also include instructions on how to > >> unsubscribe or change your account options. There is also a button on > >> your options page that will email your current password to you. > >> > >> > >> > >> > >> ___ > >> Python-Dev mailing list > >> [email protected] > >> http://mail.python.org/mailman/listinfo/python-dev > >> Unsubscribe: > >> http://mail.python.org/mailman/options/python-dev/python-python-dev%40m.gmane.org > > > > > > -- > > Steve Holden +44 150 684 7255 +1 800 494 3119 > > Holden Web LLC/Ltd http://www.holdenweb.com > > Skype: holdenweb http://del.icio.us/steve.holden > > Blog of Note: http://holdenweb.blogspot.com > > See you at PyCon? http://us.pycon.org/TX2007 > > > > ___ > > Python-Dev mailing list > > [email protected] > > http://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > > http://mail.python.org/mailman/options/python-dev/juancarlosuarez%40ciudad.com.ar > > > > > > > ___ > Python-Dev mailing list > Python-Dev@py
Re: [Python-Dev] A "record" type (was Re: Py2.6 ideas)
"Steven Bethard" <[EMAIL PROTECTED]> wrote: [snip] > In short, for object construction and attribute access, the Record > class is faster (because __init__ is a simple list of assignments and > attribute access is through C-level slots). For unpacking and > iteration, the NamedTuple factory is faster (because it's using the > C-level tuple iteration instead of a Python-level generator). Somewhere in the back of my mind something is telling me - if you can get a tuple with attributes based on __slots__, you just duplicate the references as both an attribute AND in the standard tuple PyObject* array, which could offer good speed in both cases, at the cost of twice as many pointers as the other two options. But alas, it isn't possible right now... >>> class foo(tuple): ... __slots__ = 'a' ... Traceback (most recent call last): File "", line 1, in TypeError: Error when calling the metaclass bases nonempty __slots__ not supported for subtype of 'tuple' Ah well. Anyone have any intuition as to what they will be doing with named tuples/record objects enough to know which case is better? Also, it doesn't seem like it would be terribly difficult to use metaclasses to get the ease of creation from the Record type for the NamedTuple variant, if desired. - Josiah ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] A "record" type (was Re: Py2.6 ideas)
Josiah Carlson wrote: > Somewhere in the back of my mind something is telling me - if you can > get a tuple with attributes based on __slots__, you just duplicate the > references as both an attribute AND in the standard tuple PyObject* > array, It should be possible to start with a tuple subclass and add descriptors to provide named access. If the descriptor is implemented in C it should be just as efficient as using __slots__, but with no duplication of the references. Given a suitable descriptor type, it shouldn't be hard to write a factory function to assemble such classes. -- Greg ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Making builtins more efficient
On 20/02/2007 16.07, Steven Elliott wrote: > I'm finally getting back into this. I'd like to take one more shot at > it with a revised version of what I proposed before. > > For those of you that did not see the original thread it was about ways > that accessing builtins could be more efficient. It's a bit much to > summarize again now, but you should be able to find it in the archive > with this subject and a date of 2006-03-08. Are you aware of this patch, which is still awaiting review? https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1616125&group_id=5470 -- Giovanni Bajo ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Weekly Python Patch/Bug Summary
Patch / Bug Summary
___
Patches : 408 open ( -9) / 3585 closed (+20) / 3993 total (+11)
Bugs: 968 open ( +8) / 6505 closed ( +7) / 7473 total (+15)
RFE : 267 open ( +1) / 251 closed ( +0) / 518 total ( +1)
New / Reopened Patches
__
Handle requests to intern string subtype instances (2007-02-13)
http://python.org/sf/1658799 opened by Hrvoje Nik?i?
Minor pasting patch (2007-02-13)
http://python.org/sf/1659326 opened by Tal Einat
Minor AST tweaks (2007-02-13)
http://python.org/sf/1659410 opened by Collin Winter
functools.compose to chain functions together (2007-02-14)
CLOSED http://python.org/sf/1660179 opened by Chris AtLee
IDLE doesn't save files on closing (2007-02-15)
CLOSED http://python.org/sf/1660202 opened by Toni
Hide iteration variable in list comprehensions (2007-02-15)
http://python.org/sf/1660500 opened by Nick Coghlan
ftplib passive ftp problem on multihomed clients (2007-02-16)
http://python.org/sf/1661754 opened by Tim Baum
setuptools: avoid sets module for python>2.3 (2007-02-19)
http://python.org/sf/1663226 opened by Amit Aronovitch
enable "python -m doctest FILE" to run tests in FILE (2007-02-19)
http://python.org/sf/1663234 opened by Stefan Behnel
Fix for urllib.ftpwrapper.retrfile() and none existing files (2007-02-20)
http://python.org/sf/1664522 opened by Phil Knirsch
Patches Closed
__
imputil must respect __path__ for package submodules (2003-02-12)
http://python.org/sf/685268 closed by loewis
Scalable zipfile extension (2003-09-27)
http://python.org/sf/813436 closed by loewis
zipfile and big zipped file (2004-07-17)
http://python.org/sf/992750 closed by loewis
ZipFile - support for file decryption (2003-03-06)
http://python.org/sf/698833 closed by loewis
Bug 1514451: zipfile "append" mode should create a file ... (2006-07-06)
http://python.org/sf/1517891 closed by loewis
socketmodule fails to build because missing NETLINK_DNRTMSG (2007-02-11)
http://python.org/sf/1657276 closed by loewis
gzip.GzipFile has no name attribute (2007-01-29)
http://python.org/sf/1647484 closed by gustaebel
Missing HCI sockets in bluetooth code from socketmodule (2006-02-15)
http://python.org/sf/1432399 closed by loewis
Patch to support lots of file descriptors (2006-02-19)
http://python.org/sf/1434657 closed by loewis
isapi.samples.advanced.py fix (2005-02-17)
http://python.org/sf/1126187 closed by loewis
Add IEEE Float support to wave.py (2005-02-19)
http://python.org/sf/1144504 closed by loewis
Make urllib2.OpenerDirector instances pickle-able (2005-02-20)
http://python.org/sf/1144636 closed by jjlee
functools.compose to chain functions together (2007-02-15)
http://python.org/sf/1660179 closed by loewis
IDLE doesn't save files on closing (2007-02-15)
http://python.org/sf/1660202 closed by gbrandl
decorator module (2006-03-12)
http://python.org/sf/1448297 closed by gbrandl
dictnotes.txt (2006-01-05)
http://python.org/sf/1397848 closed by loewis
Documentation for new Struct object (2006-05-24)
http://python.org/sf/1494140 closed by gbrandl
Detect incomplete readline implementation (2006-02-21)
http://python.org/sf/1435651 closed by loewis
add os.chflags() and os.lchflags() where available (2006-05-17)
http://python.org/sf/1490190 closed by loewis
Fix for bug #1486663 mutable types check kwargs in tp_new (2006-05-20)
http://python.org/sf/1491939 closed by zseil
New / Reopened Bugs
___
I think, I have found this bug on time.mktime() (2007-02-10)
CLOSED http://python.org/sf/1656559 reopened by sergiomb
This shouldn't be there: Note that this code that uses... (2007-02-13)
CLOSED http://python.org/sf/1658794 opened by Alf Lervåg
os.wait child process fail when under stress (2007-02-13)
http://python.org/sf/1658959 opened by The Groff
Calling tparm from extension lib fails in Python 2.4 (2007-02-13)
http://python.org/sf/1659171 opened by Richard B. Kreckel
Calling tparm from extension lib fails in Python 2.4 (2007-02-13)
CLOSED http://python.org/sf/1659173 opened by Richard B. Kreckel
Python extension problems after re-install (2007-02-14)
http://python.org/sf/1659705 opened by elf
continuing problem with httplib multiple set-cookie headers (2007-02-14)
http://python.org/sf/1660009 opened by David Margrave
base64.urlsafe_b64encode() shouldn't use the = character (2007-02-16)
http://python.org/sf/1661108 opened by Ryan Barrett
Misleading behavior for [] and {} default arguments (2007-02-16)
CLOSED http://python.org/sf/1661603 opened by Matthijs
finditer stuck in infinite loop (2007-02-16)
http://python.org/sf/1661745 opened by Milan
[2
