On Sat, 29 Jun 2013 23:46:12 -0600, Ian Kelly wrote:
On a related note, I think that generator functions should in some way
be explicitly marked as such in the declaration, rather than needing to
scan the entire function body for a yield statement to determine whether
it's a generator or not.
On Sun, Jun 30, 2013 at 3:46 PM, Ian Kelly ian.g.ke...@gmail.com wrote:
On a related note, I think that generator functions should in some way
be explicitly marked as such in the declaration, rather than needing
to scan the entire function body for a yield statement to determine
whether it's a
On 6/30/2013 1:46 AM, Ian Kelly wrote:
On a related note, I think that generator functions should in some way
be explicitly marked as such in the declaration, rather than needing
to scan the entire function body for a yield statement to determine
whether it's a generator or not.
I agree that
On Sun, Jun 30, 2013 at 12:11 AM, Terry Reedy tjre...@udel.edu wrote:
On 6/30/2013 1:46 AM, Ian Kelly wrote:
On a related note, I think that generator functions should in some way
be explicitly marked as such in the declaration, rather than needing
to scan the entire function body for a yield
On Sunday, June 30, 2013 10:38:01 AM UTC+5:30, Chris Angelico wrote:
On Sun, Jun 30, 2013 at 2:32 PM, Terry Reedy wrote:
One of the reasons I switched to Python was to not have to do that, or
hardly ever. For valid code, an new declaration is hardly needed. Parameters
are locals. If the
On Sunday, June 30, 2013 2:23:35 AM UTC+5:30, Terry Reedy wrote:
If, in the general case, the compiler requires two passes to understand
a function body, then *so do people*#. This requirement is what trips up
people who are either not used to the idea of two-pass compilation or do
Op 29-06-13 21:23, Ian Kelly schreef:
On Sat, Jun 29, 2013 at 11:02 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
Op 29-06-13 16:02, Michael Torrie schreef:
The real problem here is that you don't understand how python variables
work. And in fact, python does not have variables.
On Sun, 30 Jun 2013 01:56:25 -0700, rusi wrote:
[...]
All of which adds up to making scoping/variables an arcane craft.
Now having such passes is one thing. Defining the language in terms of
them quite another...
I don't believe that Python's behaviour is defined in terms of the number
of
On Sunday, June 30, 2013 4:52:24 PM UTC+5:30, Steven D'Aprano wrote:
On Sun, 30 Jun 2013 01:56:25 -0700, rusi wrote:
Now having such passes is one thing. Defining the language in terms of
them quite another...
I don't believe that Python's behaviour is defined in terms of the number
of
On Sun, Jun 30, 2013 at 4:07 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
I don't think this reference is as strong as you think it is. Here is
a paragraph somewhat lower:
] If a name is bound in a block, it is a local variable of that block,
] unless declared as nonlocal. If a name
On Sun, Jun 30, 2013 at 11:13 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Sun, Jun 30, 2013 at 4:07 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
I don't think this reference is as strong as you think it is. Here is
a paragraph somewhat lower:
] If a name is bound in a block, it is
On 30/06/2013 3:46 PM, Ian Kelly wrote:
In general I agree, although when reading code I would definitely
prefer if the locals were declared.
If you import the code into the interpreter as an adjunct to reading it
you can see the locals with:
somefunc.func_code.co_varnames # 2.x
Hi,
I'd like to use closures to set allow a subroutine to set variables in its
caller, in leu of pointers. But I can't get it to work. I have the following
test pgm, but I can't understand its behaviour:
It uses a function p2() from the module modules.closure1b:
def p2 (proc):
proc
On 29 Jun 2013 10:38, cts.private.ya...@gmail.com wrote:
Hi,
I'd like to use closures to set allow a subroutine to set variables in
its caller, in leu of pointers. But I can't get it to work. I have the
following test pgm, but I can't understand its behaviour:
It uses a function p2() from
cts.private.ya...@gmail.com wrote:
I'd like to use closures to set allow a subroutine to set variables in its
caller, in leu of pointers.
leu? Must be a Fench word ;)
But I can't get it to work. I have the
following test pgm, but I can't understand its behaviour:
It uses a function p2()
Well, it would have been French if I had spelled it right - since you force me
overcome my laziness, I see I should have spelled it lieu ...
Thank you. You reminded me of the (weak) workaround of using arrays and
confirmed my suspicion that I although I can read the variable, I won't be able
Alas, one reason it's a weak workaround is that it doesn't work - at least, not
how I wish it would:
$ cat ptrs
x = 34
def p1 (a1):
a1[0] += 12
p1 ([x])
print (x)
$ python ptrs
34
--
http://mail.python.org/mailman/listinfo/python-list
cts.private.ya...@gmail.com wrote:
As for python 3 ... nonlocal? I see I'm not alone in picking obnoxious
names ...
tous chez...
Alas, one reason it's a weak workaround is that it doesn't work - at
least, not how I wish it would:
$ cat ptrs
x = 34
def p1 (a1):
a1[0] += 12
PS: If you're reading this and love the French language -- I am deeply sorry
for the pain I'm causing you...
It's obviously a team effort...
My French ain't so hot, either. I had to google your tout chez until I ran
into the explanation:
hallo :) also ich gucke super gerne two and a half
On 06/29/2013 05:44 AM, cts.private.ya...@gmail.com wrote:
Alas, one reason it's a weak workaround is that it doesn't work - at least,
not how I wish it would:
$ cat ptrs
x = 34
def p1 (a1):
a1[0] += 12
p1 ([x])
print (x)
$ python ptrs
34
you'll have to use it
On 06/29/2013 05:21 AM, cts.private.ya...@gmail.com wrote:
Thank you. You reminded me of the (weak) workaround of using arrays
and confirmed my suspicion that I although I can read the variable, I
won't be able to write to it. I still don't understand why not,
though...
The real problem
On 29/06/2013 13:26, cts.private.ya...@gmail.com wrote:
PS: If you're reading this and love the French language -- I am deeply sorry
for the pain I'm causing you...
It's obviously a team effort...
My French ain't so hot, either. I had to google your tout chez until I ran
into the
I love the title. Reminds me of Ivanhoe ... great time travel.
--
http://mail.python.org/mailman/listinfo/python-list
Op 29-06-13 16:02, Michael Torrie schreef:
The real problem here is that you don't understand how python variables
work. And in fact, python does not have variables. It has names that
bind to objects.
I don't understand why members of this list keep saying this. Sure the
variables in python
On Saturday, June 29, 2013 10:32:01 PM UTC+5:30, Antoon Pardon wrote:
Op 29-06-13 16:02, Michael Torrie schreef:
The real problem here is that you don't understand how python variables
work. And in fact, python does not have variables. It has names that
bind to objects.
I don't
On 06/29/2013 11:02 AM, Antoon Pardon wrote:
Op 29-06-13 16:02, Michael Torrie schreef:
The real problem here is that you don't understand how python variables
work. And in fact, python does not have variables. It has names that
bind to objects.
I don't understand why members of this
On 06/29/2013 07:56 AM, Michael Torrie wrote:
x = [ 34, ]
def test_func( out ):
out[0] += 12
test_func(x)
print (x)
Well, actually
print (x[0])
--
http://mail.python.org/mailman/listinfo/python-list
:) Thank you guys for saying what I was biting my tongue about (thanks
everybody for the help, BTW!).
This python-think stuff was starting to get on my nerves - but then it
occurred to me that - although having many powerful features - it has so many
weird restrictions that it requires a
On Sat, 29 Jun 2013 04:21:46 -0700, cts.private.yahoo wrote:
Thank you. You reminded me of the (weak) workaround of using arrays
I think you mean lists, rather than arrays. Python does have an array
type, but it is much more restricted.
If you want an indirect reference to a value, the
On Sat, 29 Jun 2013 19:02:01 +0200, Antoon Pardon wrote:
Op 29-06-13 16:02, Michael Torrie schreef:
The real problem here is that you don't understand how python variables
work. And in fact, python does not have variables. It has names that
bind to objects.
I don't understand why
On 06/29/2013 12:37 PM, cts.private.ya...@gmail.com wrote:
:) Thank you guys for saying what I was biting my tongue about
(thanks everybody for the help, BTW!).
Sometimes it's best to state the actual problem you're trying to solve
and see if there's a pythonic solution that fits it rather
On Sat, 29 Jun 2013 11:37:55 -0700, cts.private.yahoo wrote:
:) Thank you guys for saying what I was biting my tongue about (thanks
everybody for the help, BTW!).
This python-think stuff was starting to get on my nerves - but then it
occurred to me that - although having many powerful
On Sat, 29 Jun 2013 18:45:30 +, Steven D'Aprano wrote:
Python require declarations for local names, but if it did it would
probably use local.
Oops, I meant *doesn't* require declarations. Sorry for the error.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 06/29/2013 12:51 PM, Steven D'Aprano wrote:
You are absolutely correct in principle. But in practice, there are ten
bazillion C, Pascal, COBOL, and BASIC programmers who understand the word
variable to mean a named memory location, for every Smalltalk or Lisp
programmer who understands a
On Sunday, June 30, 2013 12:21:35 AM UTC+5:30, Steven D'Aprano wrote:
On Sat, 29 Jun 2013 19:02:01 +0200, Antoon Pardon wrote:
We might as well say that C doesn't have variables, it has names
pointing to memory locations or value containers or something like that.
AFAICS there is no
On Sat, 29 Jun 2013 12:35:54 -0600, Michael Torrie wrote:
Python's
basic data types are immutable. At best we could say they are read-only
variables.
Python's basic data types are not necessarily immutable. Lists and dicts
are not immutable. Being a high-level language, the idea of
On Sat, Jun 29, 2013 at 11:02 AM, Antoon Pardon
antoon.par...@rece.vub.ac.be wrote:
Op 29-06-13 16:02, Michael Torrie schreef:
The real problem here is that you don't understand how python variables
work. And in fact, python does not have variables. It has names that
bind to objects.
I
exactly that. Without wanting to analyze it in too much depth now, I would
want a local keyword to allow me to know I was protecting my variables, and a
way to specify other scopes, without so much implied scoping in non-intuitive
ways...
Now everybody is gonna tell me how wrong I am, but you
On Sat, 29 Jun 2013 12:20:45 -0700, cts.private.yahoo wrote:
exactly that.
Exactly what? Who are you replying to? Your post has no context.
Without wanting to analyze it in too much depth now, I
would want a local keyword to allow me to know I was protecting my
variables, and a way to
Touchy aren't we ...
:)
--
http://mail.python.org/mailman/listinfo/python-list
On 2013-06-29 19:19, Steven D'Aprano wrote:
Nobody ever asks why Python doesn't let you sort an int, or take
the square of a list...
just to be ornery, you can sort an int:
i = 314159265
''.join(sorted(str(i)))
'112345569'
And I suppose, depending on how you define it, you can square a
On Sat, Jun 29, 2013 at 1:33 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Sat, 29 Jun 2013 12:20:45 -0700, cts.private.yahoo wrote:
Without wanting to analyze it in too much depth now, I
would want a local keyword to allow me to know I was protecting my
variables, and a
On 29 June 2013 20:42, Tim Chase t...@thechases.com wrote:
On 2013-06-29 19:19, Steven D'Aprano wrote:
Nobody ever asks why Python doesn't let you sort an int, or take
the square of a list...
just to be ornery, you can sort an int:
i = 314159265
''.join(sorted(str(i)))
'112345569'
To be
On 6/29/2013 3:47 PM, Ian Kelly wrote:
On Sat, Jun 29, 2013 at 1:33 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Sat, 29 Jun 2013 12:20:45 -0700, cts.private.yahoo wrote:
Huh? What language are you programming in? Python doesn't have implied
scoping in non-intuitive
On Sat, Jun 29, 2013 at 2:53 PM, Terry Reedy tjre...@udel.edu wrote:
# The alternative for either program or people is a 1-pass + backtracking
process where all understandings are kept provisional until the end of the
body and revised as required. 2 passes are simpler.
Or simply an explicit
No, actually, it's okay that it's local by default, after all. TCL's got that
capability of explicitly specifying the scope (up n or something like that?).
That's okay for tcl, not sure if it would seem so elegant for python. But you
can't tell me that the scenarios that I presented in the
On 06/29/2013 01:19 PM, Steven D'Aprano wrote:
Python's basic data types are not necessarily immutable. Lists and dicts
are not immutable. Being a high-level language, the idea of primitives
like int, double, float, etc from C doesn't really apply. A Python dict
is not made up from Python
On 06/29/2013 01:20 PM, cts.private.ya...@gmail.com wrote:
exactly that. Without wanting to analyze it in too much depth now, I
would want a local keyword to allow me to know I was protecting my
variables, and a way to specify other scopes, without so much implied
scoping in non-intuitive
On Sat, 29 Jun 2013 14:42:58 -0500, Tim Chase wrote:
On 2013-06-29 19:19, Steven D'Aprano wrote:
Nobody ever asks why Python doesn't let you sort an int, or take the
square of a list...
just to be ornery, you can sort an int:
i = 314159265
''.join(sorted(str(i)))
'112345569'
And I
On 6/29/2013 5:21 PM, Ian Kelly wrote:
On Sat, Jun 29, 2013 at 2:53 PM, Terry Reedy tjre...@udel.edu wrote:
# The alternative for either program or people is a 1-pass + backtracking
process where all understandings are kept provisional until the end of the
body and revised as required. 2 passes
On Sun, Jun 30, 2013 at 2:32 PM, Terry Reedy tjre...@udel.edu wrote:
On 6/29/2013 5:21 PM, Ian Kelly wrote:
On Sat, Jun 29, 2013 at 2:53 PM, Terry Reedy tjre...@udel.edu wrote:
# The alternative for either program or people is a 1-pass + backtracking
process where all understandings are kept
On Sat, Jun 29, 2013 at 10:32 PM, Terry Reedy tjre...@udel.edu wrote:
On 6/29/2013 5:21 PM, Ian Kelly wrote:
Or simply an explicit declaration of scope at the beginning of the
function definition.
One of the reasons I switched to Python was to not have to do that, or
hardly ever. For valid
52 matches
Mail list logo