Andrew Koenig wrote:
Incidentally, I think that lexical scoping would also deal with the problem
that people often encounter in which they have to write things like lambda
x=x: where one would think lambda x: would suffice.
This is another red herring. Python's problem here
is not because its
Josiah Carlson wrote:
What I asked before, and what I'd like to ask again, is if there are any
_nontrivial uses_ of lexically nested scopes which are made cumbersome
by our inability to write to parent scopes.
The trouble with taking that position is that the very
cases which would benefit
Giovanni Bajo wrote:
a = []
for i in range(10):
... a.append(lambda: i)
...
print [x() for x in a]
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
This subtle semantic of lambda is quite confusing, and still forces people to
use the i=i trick.
This has *nothing* to do with the semantics of
[Tim Peters]
Note that this is quite unlike Scheme, in which declaration must
appear before use (ignoring fancy letrec cases),
[Greg Ewing]
I think that's overstating things a bit --
So do I :-), but I don't really care about Scheme here.
mutually recursive functions are quite easy to write
On Saturday 01 July 2006 12:55, Guido van Rossum wrote:
It's up to the release manager now to decide whether the pitchforks
at Google or the pitchforks in the larger Python community are
sharper. ;-)
At this point, I think removing the warning code is the prudent
course. If someone wanted to
Guido van Rossum wrote:
It's up to the release manager now to decide whether the pitchforks at
Google or the pitchforks in the larger Python community are sharper.
;-)
--Guido (ducks)
I vaguely recall one of the reasons we went with the warning approach was to
find out whether or not
On Saturday 01 July 2006 05:19, Martin v. Löwis wrote:
James Y Knight wrote:
I just submitted http://python.org/sf/1515169 for the
ImportWarning issue previously discussed here. IMO it's
important.
At the moment (i.e. without an acceptable alternative
implementation) it's primarily a
[Giovanni Bajo]
a = []
for i in range(10):
... a.append(lambda: i)
...
print [x() for x in a]
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
This subtle semantic of lambda is quite confusing, and still forces people to
use the i=i trick.
[Greg Ewing]
This has *nothing* to do with the
Giovanni Bajo wrote:
Yes but:
a = []
for i in range(10):
... a.append(lambda: i)
...
print [x() for x in a]
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
This subtle semantic of lambda is quite confusing, and still forces people to
use the i=i trick.
If you'd like each function instance to have
Anthony Baxter wrote:
given the number of people and ways that this can emit a spurious
warning, I think it should be reverted for 2.5. At _best_ we could
maybe have a new -W switch to make it be generated, but this should
be off by default.
Last line of warnings.py
Copy, paste,
Hi all,
On Fri, Jun 30, 2006 at 10:05:14AM -0400, Frank Wierzbicki wrote:
some checks for CPython internal tests that should be excluded from
Jython
I know Frank already knows about this, but I take the occasion to remind
us that
Hi Josiah,
On Fri, Jun 30, 2006 at 01:27:24PM -0700, Josiah Carlson wrote:
I'll just have to gracefully degrade functionality for older Pythons.
More precisely, the bug shows up because in
while 1:
pass
the current line remains on the 'pass' forever. It works for a loop
like that:
Greg Ewing [EMAIL PROTECTED] wrote:
Josiah Carlson wrote:
What I asked before, and what I'd like to ask again, is if there are any
_nontrivial uses_ of lexically nested scopes which are made cumbersome
by our inability to write to parent scopes.
The trouble with taking that position
Georg Brandl wrote:
In string_replace, there is
if (PyString_Check(from)) {
/* Can this be made a '!check' after the Unicode check? */
}
#ifdef Py_USING_UNICODE
if (PyUnicode_Check(from))
return PyUnicode_Replace((PyObject *)self,
Georg Brandl wrote:
Can this be correct if from or to isn't a string object, but a
char buffer compatible object?
May I note that this is still unresolved? I can submit a bug report
and add it to PEP 356, too...
it's already on my todo list, but that list is full of stuff, so having
it on
Fredrik Lundh wrote:
Georg Brandl wrote:
Can this be correct if from or to isn't a string object, but a
char buffer compatible object?
May I note that this is still unresolved? I can submit a bug report
and add it to PEP 356, too...
it's already on my todo list, but that list is full
weakattr (weak attributes) are attributes that are weakly referencedby their containing object. they are very useful for cyclic references --an object that holds a reference to itself. when a cyclic reference is found by the GC, the memory may be
freed, but __del__ is not called, because it's
Ka-Ping Yee [EMAIL PROTECTED] wrote:
Most other languages that support lexical scoping (including Scheme,
JavaScript, Ruby, Perl, E, Java, Smalltalk) provide a uniform way
to read and write to scopes at all levels. This is done by letting
programmers specify the scope in which they want a
On Jul 1, 2006, at 5:32 AM, [EMAIL PROTECTED] wrote:
Just upgraded my Mac to OSX 10.4.7 yesterday. svn up'd Python
trunk, then
make clean ; configure ; make and I see that building the zlib
module
fails:
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-
fused-madd
On 7/1/06, Josiah Carlson [EMAIL PROTECTED] wrote:
There's one very simple way we could do this in Py3k without requiring any new syntax or keywords: just redefine the meaning of global to mean not local.I would probably be a solid -0 on such a proposal; I still don't think
it's really necessary,
Ronald Are you sure you're building on a 10.4 box? Both the
Ronald macosx-10.3 thingy and lack of inflateCopy seem to indicate that
Ronald you're running on 10.3.
Well, yeah, pretty sure. Let's see. The box with the disk says Mac OS X
Tiger - Version 10.4 on the spine. The About
All,
I tried to implement Jean-Paul Calderone's idea for the following patch,
plagiarizing Ralf W. Grosse-Kunstleve's error text. It delays import
warning until end of search for modules, but remembers how many
potential modules (candidates without __init__.py) it didn't import. I
didn't really
On Sat, Jul 01, 2006, Sergey A. Lipnevich wrote:
Please let me know if this would work and if anything needs to be done
for this patch to be accepted.
The first thing you need to do for ANY patch to be considered is to post
it so SourceForge (or at least post to python-dev explaining that
Sergey A. Lipnevich wrote:
I tried to implement Jean-Paul Calderone's idea for the following patch,
plagiarizing Ralf W. Grosse-Kunstleve's error text. It delays import
warning until end of search for modules, but remembers how many
potential modules (candidates without __init__.py) it didn't
Martin v. Löwis wrote:
Sergey A. Lipnevich wrote:
I tried to implement Jean-Paul Calderone's idea for the following patch,
plagiarizing Ralf W. Grosse-Kunstleve's error text. It delays import
...
Please notice that there is also python.org/sf/1515361
I had no time to compare this with your
What about doing something similar to how import was changed?
.a = 5 # this scope (self might be too magical
..a = 3 # up one scope
...a # up three
Of course, this looks ... perhaps a bit strange. Also, counting is a
bother.
//Simon
___
Python-Dev
Ronald Oussoren wrote:
What I don't understand yet is why your copy of libz doesn't have
inflateCopy.
What I don't understand is that configure does not detect that.
Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
a = []
for i in range(10):
a.append(lambda: i)
print [x() for x in a]
[9, 9, 9, 9, 9, 9, 9, 9, 9, 9]
Aha! -- Thank you for jogging my memory.
You seem to be right -- the problem is not that Python is lexically scoped,
but that when you define a variable with =, it leaks out into the
What about doing something similar to how import was changed?
.a = 5 # this scope (self might be too magical
..a = 3 # up one scope
...a # up three
Of course, this looks ... perhaps a bit strange. Also, counting is a
bother.
I'd rather see a simpler rule: = never defines a variable in a
On Jul 1, 2006, at 8:46 PM, Martin v. Löwis wrote:
Ronald Oussoren wrote:
What I don't understand yet is why your copy of libz doesn't have
inflateCopy.
What I don't understand is that configure does not detect that.
You may be onto something there. Skip, do you have another copy of
On Jul 1, 2006, at 10:45 AM, Ronald Oussoren wrote:
On Jul 1, 2006, at 6:57 PM, [EMAIL PROTECTED] wrote:
Ronald Are you sure you're building on a 10.4 box? Both the
Ronald macosx-10.3 thingy and lack of inflateCopy seem to
indicate that
Ronald you're running on 10.3.
Andrew Koenig wrote:
Suppose I write
x = []
for i in range(10):
x.append(lambda:i)
print [f() for f in x]
This example will print [9, 9, 9, 9, 9, 9, 9, 9, 9, 9], which I think
is wildly unintuitive.
That is my point: to me, it's counter-intuitive just like the infamous
except NameError,
Hello,
I posted it as a pre-PEP, in the hope that it may become a PEP and
be accepted. As it happened, Guido said no at the end, so I stopped
pushing the subject.
I think that the main reason for the no was that my use case wasn't
convincing enough - the objections were that this wasn't useful
Brett Cannon wrote:
I don't know how JavaScript is doing it yet. The critical thing for me
for this month was trying to come up with a security model.
And if you don't think it is going to scale, how do you think it should
be done?
if I remember correctly, the boundary/granularity of
On 6/30/06, Greg Ewing [EMAIL PROTECTED] wrote:
Brett Cannon wrote: 1) Is removing 'file' from the builtins dict in PyInterpreterState (and maybe some other things) going to be safe enough to sufficiently hide 'file' confidently (short of someone being stupid in their C extension
module and
Ronald What does /usr/lib/libz.dylib point to on your system?
% cd /usr/lib
% ls -l libz.*
lrwxr-xr-x 1 root wheel 12 Feb 12 00:32 libz.1.1.3.dylib -
libz.1.dylib
-rwxr-xr-x 1 root wheel 72588 Jun 29 18:36 libz.1.2.3.dylib
lrwxr-xr-x 1 root wheel 16
Noam If the only result of me posting it as a PEP is a final rejected
Noam status that will prevent any chance of that happening, I don't
Noam think I'll bother to make it a PEP. If it's not the case, then
Noam I'll make it a PEP and post it.
Even if it's ultimately rejected, it
On Sat, 1 Jul 2006, Greg Ewing wrote:
I don't disagree with anything you said, but I think it
would be a good idea to avoid using phrases like proper
lexical scopes, which is likely to set people off on
a tangent. The issue isn't lexicality, it's writeability.
Fully functional lexical scopes,
Fully functional lexical scopes, then?
Fine-grained scopes?
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
Don't recall what that was, but creating a new scope on each iteration
sounds hard to explain in Python.
I don't think it's particularly hard to explain. For example, one way to
explain it is to say that
for i in stuff:
body
is equivalent to
for hiddenvar in
[Tim]
Don't recall what that was, but creating a new scope on each iteration
sounds hard to explain in Python.
[Andrew Koenig]
I don't think it's particularly hard to explain. For example, one way to
explain it is
to say that
for i in stuff:
body
is equivalent
On Friday 30 June 2006 16:03, Martin v. Löwis wrote:
If you have a patch, you should commit it to our copy. Make sure you
activate the test case, so that somebody incorporating the next Expat
release doesn't mistakenly roll back your change.
A modified version of Brett's patch has been
Neil Schemenauer wrote:
The := would assign but not declare a variable
in the current scope.
There are other benefits to such a statement, too, since we can make it
similar to other augmented assignments by letting the object being assigned to
interfere with the process.
a := 2
could
Armin Rigo [EMAIL PROTECTED] wrote:
Hi Josiah,
On Fri, Jun 30, 2006 at 01:27:24PM -0700, Josiah Carlson wrote:
I'll just have to gracefully degrade functionality for older Pythons.
More precisely, the bug shows up because in
while 1:
pass
the current line remains on the
tomer filiba [EMAIL PROTECTED] wrote:
weakattr (weak attributes) are attributes that are weakly referenced
by their containing object. they are very useful for cyclic references --
an object that holds a reference to itself.
I like the added functionality offered with weakattrs as defined.
Talin [EMAIL PROTECTED] wrote:
Here's another stab at the explicit freezing school of thought on the
switch semantics. The idea is to borrow the freeze protocol and apply it
to functions.
-1 . Freezing was previously questionably useful in the realm of
general data structures. Using
46 matches
Mail list logo