On behalf of the Python development team and the Python community, I'm
happy to announce the first alpha of Python 2.4.
Python 2.4a1 is an alpha release. We'd greatly appreciate it if you
could download it, kick the tires and let us know of any problems you
find, but it is not suitable for production usage. http://www.python.org/2.4/
In this release we have a number of new modules, a number of existing
modules that have been reimplemented in C for speed, a large number of
improvements and additions to existing modules and an even larger list
of bugs squished. See either the highlights, the What's New in Python
2.4, or the detailed NEWS file -- all available from the Python 2.4
webpage.
There will be at least one more alpha release in a couple of weeks to
pick up a few new features that didn't make it into the first alpha,
before we release 2.4 betas and then the final release.
Please log any problems you have with this release in the SourceForge
bug tracker (noting that you're using 2.4a1): http://sourceforge.net/bugs/?group_id=5470
Enjoy the new release,
Anthony
Anthony Baxter an*****@python. org
Python Release Manager
(on behalf of the entire python-dev team) 21 1597
Anthony Baxter wrote: On behalf of the Python development team and the Python community, I'm happy to announce the first alpha of Python 2.4.
Congratulations on a terrific job, as always. Just to be curious:
clearly, function decorators didn't make it in this release. Will they
be incorporated in the beta?
Regards,
Iwan
Anthony Baxter <an*****@python .org> wrote in message news:<ma******* *************** *************** @python.org>... On behalf of the Python development team and the Python community, I'm happy to announce the first alpha of Python 2.4. <snip>
Uhm ... I see generator expressions have late bindings, just as list comprehensions: f1,f2,f3=tuple( lambda : i for i in [1,2,3]) f1()
3 f2()
3 f3()
3
I was more in the camp of early bindings; I would like to know if late
bindings are final or subject to changes and it there a pronouncement
from Guido.
Michele Simionato
On 9 Jul 2004, Michele Simionato wrote: Uhm ... I see generator expressions have late bindings, just as list comprehensions:
f1,f2,f3=tuple( lambda : i for i in [1,2,3]) f1() 3 f2() 3 f3() 3
I think this is a property of lambdas (or functions in general), rather
than comprehensions: i=1 f1=lambda: i i=2 f2=lambda: i i=3 f3=lambda: i f1()
3 f2()
3 f3()
3
Anthony Baxter wrote: On behalf of the Python development team and the Python community, I'm happy to announce the first alpha of Python 2.4.
Great stuff.
One thing ; the format test isn't working:
(Mandrake 10, gcc 3.3.2)
$ make test
....
test_format
test test_format produced unexpected output:
*************** *************** *************** *************** **********
*** line 2 of actual output doesn't appear in expected output after line 1:
+ u'%f' % (1.0,) == u'1,000000' != '1.000000'
*************** *************** *************** *************** **********
test_fpformat
....
test_zlib
249 tests OK.
1 test failed:
test_format
30 tests skipped:
test_aepack test_al test_applesingl e test_bsddb185 test_bsddb3
.....
I'm wondering where the u'1,000000' comes from... because when I type
on the interactive prompt:
Python 2.4a1 (#1, Jul 9 2004, 15:42:46)
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2
Type "help", "copyright" , "credits" or "license" for more information. u'%f' % (1.0,)
u'1.000000'
--Irmen.
[Michele Simionato] Uhm ... I see generator expressions have late bindings, just as list comprehensions:
f1,f2,f3=tuple( lambda : i for i in [1,2,3]) f1() 3 f2() 3 f3()
3
I was more in the camp of early bindings; I would like to know if late bindings are final or subject to changes and it there a pronouncement from Guido.
Guido Pronounced: the expression in the leftmost "for" clause is
evaluated immediately, but all the rest is delayed. So in your
example, only "[1, 2, 3]" is evaluated at the time the genexp is
created. If you had tried to iterate instead over, say, range(1/0),
the ZeroDivisionErr or would have been raised immediately, which is the
real point of evaluating that one piece "early".
Don't ask me to justify the rest <wink>.
Guido doesn't really care about examples like yours. He thinks
genexps will overwhelmingly be consumed "on the same line" they're
created, and that people doing fancy-pants stuff like you're doing
there probably shouldn't (but could find more-or-less obvious
workarounds if they had to, given that they're obsessed enough to try
such fancy-pants stuff to begin with).
The world won't end either way (IMO), and (also IMO) Python has pushed
delayed code blocks in a scoped language without explicit scope
declarations about as far as it can without becoming plainly
incomprehensibl e.
Christopher T King <sq******@WPI.E DU> wrote in message news:<Pi******* *************** *************** @ccc3.wpi.edu>. .. I think this is a property of lambdas (or functions in general), rather than comprehensions:
i=1 f1=lambda: i i=2 f2=lambda: i i=3 f3=lambda: i f1() 3 f2() 3 f3()
3
No, it is due to the fact that looping does not create a new lexical
scope. This was discussed in depth in the past. Google in this
newgroup.
Scheme does it right:
; scheme is the same as in Python here
msi> (define i 1)
msi> (define (f1) i)
msi> (set! i 2)
msi> (define (f2) i)
msi> (set! i 3)
msi> (define (f3) i)
msi> (f1)
3
msi> (f2)
3
msi> (f3)
3
; Scheme is different in looping constructs
msi> (define-values (f1 f2 f3) (apply values (map (lambda(i) (lambda()
i)) '(1 2 3))))
msi> (f1)
1
msi> (f2)
2
msi> (f3)
3
After long discussions in previous threads, I do understand well why
it is so;
I also understand why in regular "for" loops Python behavior has to be
the one
it is, since "for" does not create a new lexical scope. In my opinion,
however, it would have made more sense to have generator-expressions
with
early bindings.
But, anyway, Tim Peters is right that this issue does not make a
big difference for casual programmers and sophysticated programmers
know the workarounds.
Michele Simionato
Tim Peters <ti********@gma il.com> wrote in message news:<ma******* *************** *************** @python.org>... Guido Pronounced: the expression in the leftmost "for" clause is evaluated immediately, but all the rest is delayed. So in your example, only "[1, 2, 3]" is evaluated at the time the genexp is created. If you had tried to iterate instead over, say, range(1/0), the ZeroDivisionErr or would have been raised immediately, which is the real point of evaluating that one piece "early".
Don't ask me to justify the rest <wink>.
Guido doesn't really care about examples like yours. He thinks genexps will overwhelmingly be consumed "on the same line" they're created, and that people doing fancy-pants stuff like you're doing there probably shouldn't (but could find more-or-less obvious workarounds if they had to, given that they're obsessed enough to try such fancy-pants stuff to begin with).
The world won't end either way (IMO), and (also IMO) Python has pushed delayed code blocks in a scoped language without explicit scope declarations about as far as it can without becoming plainly incomprehensibl e.
It happened to me more than once to think that Guido made something
wrong and to change my mind months later. So this maybe one of those
occasions. The problems is mostly for people coming from functional
languages. Incidentally, I got caught by this a couple of year ago
and this was the reason for my first post on the newsgroup (I was
playing with Tkinter at the time and lambda's are useful as callback
functions). At the time I had no experience with functional languages,
but still I had a functional mindset due to my strong mathematical
background and experience with Mathematica/Maple.
The simplest workaround is Pythonic in the sense that it is explicit
f1,f2,f3=tuple( lambda i=i: i for i in [1,2,3])
as one explicitly rebinds "i" at each iteration but still I cannot
find it other than hackish, since there is no point here in creating
a function with default arguments other than fixing the
binding-in-iteration
issue. What I would need is a better way to create function objects
than
lambda's; for instance I would like the ability to subclass the
function type and customize it to my needs (but I have already talked
about this in the
past http://groups.google.it/groups?hl=it...gle.com&rnum=1
so I want repeat myself).
If I had that, the binding-in-iteration issue would be minor for me
and I
would not protest anymore. Actually I would probably think that it is
good
to have a broken binding-in-iteration behavior, so people are
encouraged
not to use lambda's and to generate their functions in other ways.
Michele Simionato
On Sat, 9 Jul 2004, Michele Simionato wrote:
MS> The simplest workaround is Pythonic in the sense that it is
MS> explicit
MS>
MS> f1,f2,f3=tuple( lambda i=i: i for i in [1,2,3])
MS>
MS> as one explicitly rebinds "i" at each iteration but still I
MS> cannot
MS> find it other than hackish, since there is no point here in
MS> creating
MS> a function with default arguments other than fixing the
MS> binding-in-iteration
You can bind explicitly without default argument hack: f1, f2, f3 = [(lambda i: lambda: i)(i) for i in [1, 2, 3]] f1()
1 f2()
2 f3()
3
I think the same will apply to generator expression too.
--
Denis S. Otkidach http://www.python.ru/ [ru]
On 9 Jul 2004 11:38:00 -0700, mi************* **@gmail.com (Michele Simionato) wrote: Anthony Baxter <an*****@python .org> wrote in message news:<ma******* *************** *************** @python.org>... On behalf of the Python development team and the Python community, I'm happy to announce the first alpha of Python 2.4. <snip> Uhm ... I see generator expressions have late bindings, just as list comprehensions:
f1,f2,f3=tuple( lambda : i for i in [1,2,3]) f1()3 f2()3 f3()3
I guess I don't know what you mean by "late binding" -- i.e., I don't see
a semantic difference between (I don't have the generator expression version yet): f1,f2,f3=[lambda : i for i in [1,2,3]] f1(),f2(),f3()
(3, 3, 3)
and
lamb = lambda : i f1,f2,f3=[lamb for i in [1,2,3]] f1(),f2(),f3()
(3, 3, 3)
ISTM it is a matter of late lookup, more than late binding. I.e.,
the lambda expression specifies lookup of a name "i" when it is executed:
import dis dis.dis(lambda : i)
1 0 LOAD_GLOBAL 0 (i)
3 RETURN_VALUE
The list comprehension didn't generate a different lookup: f1,f2,f3=[lambda : i for i in [1,2,3]] dis.dis(f1)
1 0 LOAD_GLOBAL 0 (i)
3 RETURN_VALUE
BTW, if list comprehension variables bound in a loop-private scope instead of
the enclosing scope, the lookup of i would fail unless otherwise set ;-)
Will generator expressions bind in the eclosing scope too? Have the consequences been discussed?
Anyway, as I think you know, to get your desired end result, you have to create lambdas
that will do their lookups referring to different i's -- which you can do with closures, e.g.,
f1,f2,f3=[(lambda i: lambda : i)(i) for i in [1,2,3]] f1(),f2(),f3()
(1, 2, 3) dis.dis(f1)
1 0 LOAD_DEREF 0 (i)
3 RETURN_VALUE
Or here's another of several other possible ways:
f1,f2,f3=[(lambda i:i).__get__(i, int) for i in [1,2,3]] f1(),f2(),f3()
(1, 2, 3) dis.dis(f1)
1 0 LOAD_FAST 0 (i)
3 RETURN_VALUE
BTW, those are bound methods ... f1,f2,f3
(<bound method int.<lambda> of 1>, <bound method int.<lambda> of 2>, <bound method int.<lambda> of 3>)
I was more in the camp of early bindings; I would like to know if late bindings are final or subject to changes and it there a pronouncement from Guido.
Michele Simionato
Regards,
Bengt Richter This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anthony Baxter |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On behalf of the Python development team and the Python community, I'm
happy to announce the second alpha of Python 2.4.
Python 2.4a2 is an alpha release. We'd greatly appreciate it if you
could download it, kick the tires and let us know of any problems you
find, but it is not suitable for...
|
by: Anthony Baxter |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On behalf of the Python development team and the Python community, I'm
happy to announce the third alpha of Python 2.4.
Python 2.4a3 is an alpha release. We'd greatly appreciate it if you
could download it, kick the tires and let us know of any problems you
find, but it is not suitable for...
|
by: Anthony Baxter |
last post by:
On behalf of the Python development team and the Python
community, I'm happy to announce the first alpha release
of Python 2.5.
This is an *alpha* release of Python 2.5, and is the *first*
alpha release. As such, it is not suitable for a production
environment. It is being released to solicit feedback and
hopefully discover bugs, as well...
|
by: Anthony Baxter |
last post by:
On behalf of the Python development team and the Python
community, I'm happy to announce the second alpha release
of Python 2.5.
This is an *alpha* release of Python 2.5. As such, it is not
suitable for a production environment. It is being released to
solicit feedback and hopefully discover bugs, as well as allowing
you to determine how...
|
by: Guido van Rossum |
last post by:
python-list@python.org]
The first Python 3000 release is out -- Python 3.0a1. Be the first one
on your block to download it!
http://python.org/download/releases/3.0/
Excerpts:
Python 3000 (a.k.a. "Py3k", and released as Python 3.0) is a new
| |
by: Barry Warsaw |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On behalf of the Python development team and the Python community, I'm
happy to announce the first alpha release of Python 2.6, and the third
alpha release of Python 3.0.
Python 2.6 is not only the next advancement in the Python 2 series, it
is also a transitionary release, helping developers...
|
by: Barry Warsaw |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On behalf of the Python development team and the Python community, I'm
happy to announce the second alpha release of Python 2.6, and the
fourth alpha release of Python 3.0.
Please note that these are alpha releases, and as such are not
suitable for production environments. We continue to...
|
by: Barry Warsaw |
last post by:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On behalf of the Python development team and the Python community, I
am happy to announce the third alpha release of Python 2.6, and the
fifth alpha release of Python 3.0.
Please note that these are alpha releases, and as such are not
suitable for production environments. We continue to...
|
by: =?ISO-8859-1?Q?Andr=E9?= |
last post by:
Hi everyone,
Crunchy version 1.0 alpha 1 has been released.
Crunchy is an application that transforms normally static Python
tutorial (html files, or reStructuredText ones - if docutils is
installed on your computer) into interactive sessions within your
browser (Firefox).
It is available from http://code.google.com/p/crunchy/
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| | |