On Friday, February 28, 2014 9:50:09 AM UTC-6, Steven D'Aprano wrote:
PS On the topic of enums, when are we getting support for a switch
statement?
http://legacy.python.org/dev/peps/pep-3103/
http://legacy.python.org/dev/peps/pep-0275/
I have reviewed these peps, and I heard Guido's
Mark H. Harris harrismh...@gmail.com:
I think the real issue is about the syntax... because of python's
unique indent strategy going back to ABC, a pythonized switch
statement would play havoc with the many text parsers out there used
for development (TestWrangler, and many others).
I also
On Sat, Mar 1, 2014 at 5:53 AM, Marko Rauhamaa ma...@pacujo.net wrote:
A dict dispatch table is just awful.
Really? How is that? I've used them, often. Yes, there are times when
I could express something more cleanly with a C-style switch
statement, but other times the dispatch table is
Chris Angelico ros...@gmail.com:
On Sat, Mar 1, 2014 at 5:53 AM, Marko Rauhamaa ma...@pacujo.net wrote:
A dict dispatch table is just awful.
Really? How is that? I've used them, often. Yes, there are times when
I could express something more cleanly with a C-style switch
statement, but
On Friday, February 28, 2014 1:20:52 PM UTC-6, Marko Rauhamaa wrote:
Which do *you* find more readable?
Yep, my point exactly. nice illustration.
--
https://mail.python.org/mailman/listinfo/python-list
Mark H. Harris harrismh...@gmail.com:
Yep, my point exactly. nice illustration.
So now, for you and me: let's compare.
if key is ast.Assign:
return ' '.join(dump(t) for t in node.targets)
elif key is ast.AugAssign:
# Same target and same operator.
return
On 28/02/2014 21:03, Marko Rauhamaa wrote:
Mark H. Harris harrismh...@gmail.com:
Yep, my point exactly. nice illustration.
So now, for you and me: let's compare.
if key is ast.Assign:
return ' '.join(dump(t) for t in node.targets)
elif key is ast.AugAssign:
#
On Fri, 28 Feb 2014 20:53:15 +0200, Marko Rauhamaa wrote:
Mark H. Harris harrismh...@gmail.com:
I think the real issue is about the syntax... because of python's
unique indent strategy going back to ABC, a pythonized switch statement
would play havoc with the many text parsers out there
Mark Lawrence breamore...@yahoo.co.uk:
http://c2.com/cgi/wiki?SwitchStatementsSmell
Your brief summary, please, Mark?
Anyway, the first 1000 lines or so that I managed to read from that page
stated a valid principle, which however doesn't invalidate the existence
of a switch statement.
A
Marko Rauhamaa ma...@pacujo.net writes:
Ben Finney ben+pyt...@benfinney.id.au:
First reason: This is better done by making it clear the value is an
arbitrary object that won't be compared for equality. Just use
‘object()’ to creeate each value and be done with it. That's a hack,
but
On Fri, 28 Feb 2014 21:20:52 +0200, Marko Rauhamaa wrote:
Your example:
[snip]
I'm not going to show the example as quoted by you, because my news
client is wrapping it in ugly ways and I don't want to spend the time
fixing it. I'll just say that, as given, it's a great big wall of text, a
On Friday, February 28, 2014 3:03:25 PM UTC-6, Marko Rauhamaa wrote:
Marko
... and between me and you, here is a snip from dmath.py from the atan(x)
function:
if (n**2 D(1)):
a = __atan__(n)
elif (n == D(1)):
a = gpi/4
elif (n == D(-1)):
a = -(gpi/4)
Marko Rauhamaa ma...@pacujo.net writes:
Mark Lawrence breamore...@yahoo.co.uk:
http://c2.com/cgi/wiki?SwitchStatementsSmell
Your brief summary, please, Mark?
Anyway, the first 1000 lines or so that I managed to read from that page
stated a valid principle, which however doesn't
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
You can't have it both ways: you cannot claim that switch or case is
more readable than a chain of if...elif, and then propose a syntax
which is effectively a chain of if...elif while still claiming it is
an improvement. It's not. All
Ben Finney ben+pyt...@benfinney.id.au:
As has been pointed out to you, the whole point here is that string
objects often *are not* distinct, despite conceptually having distinct
cretion in the source.
You know full well that this initialization creates references to
distinct objects:
On Fri, 28 Feb 2014 14:25:54 +0200, Marko Rauhamaa wrote:
Chris Angelico ros...@gmail.com:
On Fri, Feb 28, 2014 at 10:30 PM, Marko Rauhamaa ma...@pacujo.net
wrote:
Chris Angelico ros...@gmail.com:
a.state = a.INIT
In theory, yes. If that's all people will ever do, then you can safely
Mark H. Harris harrismh...@gmail.com:
if (n**2 D(1)):
a = __atan__(n)
elif (n == D(1)):
a = gpi/4
elif (n == D(-1)):
a = -(gpi/4)
elif (n D(-1)):
a = __atan__Lt_neg1__(n)
else:
a = __atan__Gt_1__(n)
Drop the outermost
On 2/28/14 6:36 PM, Mark H. Harris wrote:
On Friday, February 28, 2014 3:03:25 PM UTC-6, Marko Rauhamaa wrote:
Marko
... and between me and you, here is a snip from dmath.py from the atan(x)
function:
if (n**2 D(1)):
a = __atan__(n)
elif (n == D(1)):
a =
On Sat, 01 Mar 2014 02:03:51 +0200, Marko Rauhamaa wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
You can't have it both ways: you cannot claim that switch or case is
more readable than a chain of if...elif, and then propose a syntax
which is effectively a chain of if...elif
Marko Rauhamaa ma...@pacujo.net writes:
Ben Finney ben+pyt...@benfinney.id.au:
As has been pointed out to you, the whole point here is that string
objects often *are not* distinct, despite conceptually having distinct
cretion in the source.
You know full well that this initialization
On Sat, 01 Mar 2014 02:11:53 +0200, Marko Rauhamaa wrote:
Ben Finney ben+pyt...@benfinney.id.au:
As has been pointed out to you, the whole point here is that string
objects often *are not* distinct, despite conceptually having distinct
cretion in the source.
You know full well that this
On 01/03/2014 00:40, Ned Batchelder wrote:
On 2/28/14 6:36 PM, Mark H. Harris wrote:
On Friday, February 28, 2014 3:03:25 PM UTC-6, Marko Rauhamaa wrote:
Marko
... and between me and you, here is a snip from dmath.py from the
atan(x) function:
if (n**2 D(1)):
a =
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
I can only imagine you mean something like this:
class Outer:
class InnerOne:
...
class InnerTwo:
...
class InnerThree:
...
No, I mean this:
class StateMachine:
def __init__(self):
On Friday, February 28, 2014 6:40:06 PM UTC-6, Ned Batchelder wrote:
I don't understand: you show an if/elif chain that cannot be expressed
as a switch statement (because it uses ), and then conclude that
Python needs a switch statement? That doesn't make any sense.
Forgive me. I
Ben Finney ben+pyt...@benfinney.id.au:
From each other, of course they're distinct, because they are unequal.
They are *not* necessarily distinct from other strings with equal
value, defined elsewhere. That's what has been pointed out to you many
times.
That point is completely irrelevant.
On 01/03/2014 00:03, Marko Rauhamaa wrote:
Dict dispatch tables are elegant, attractive and efficient if you are
using pre-existing functions or functions you can create using lambda:
I beg to differ. The dict dispatch tables are very hard to read. The
fully blown-out if-else chain beats it
On 01/03/2014 01:10, Marko Rauhamaa wrote:
Ben Finney ben+pyt...@benfinney.id.au:
From each other, of course they're distinct, because they are unequal.
They are *not* necessarily distinct from other strings with equal
value, defined elsewhere. That's what has been pointed out to you many
On Friday, February 28, 2014 7:10:49 PM UTC-6, Mark Lawrence wrote:
I think you're talking nonsense. I've been happily using dict dispatch
tables for years and, like Steven and presumably many others, find them
dead easy to read. Perhaps you should invest in a better optician
and/or
Marko Rauhamaa ma...@pacujo.net writes:
Ben Finney ben+pyt...@benfinney.id.au:
They are *not* necessarily distinct from other strings with equal
value, defined elsewhere. That's what has been pointed out to you
many times.
That point is completely irrelevant. The state objects only need
On Sat, Mar 1, 2014 at 6:20 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Your example:
compare_key = {
# Same target(s).
ast.Assign: lambda node: ' '.join(dump(t) for t in node.targets),
# Same target and same operator.
ast.AugAssign: lambda node:
On Sat, 01 Mar 2014 03:06:38 +0200, Marko Rauhamaa wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
I can only imagine you mean something like this:
class Outer:
class InnerOne:
...
class InnerTwo:
...
class InnerThree:
...
No, I
On Sat, Mar 1, 2014 at 10:06 AM, Marko Rauhamaa ma...@pacujo.net wrote:
A colleague of mine taught me decades back that the whole point of OO
was the avoidance of if and switch statements. So if your code has an if
or switch statement, chances are you are doing something wrong.
I agree.
On Sat, Mar 1, 2014 at 12:08 PM, Mark H. Harris harrismh...@gmail.com wrote:
On Friday, February 28, 2014 6:40:06 PM UTC-6, Ned Batchelder wrote:
I don't understand: you show an if/elif chain that cannot be expressed
as a switch statement (because it uses ), and then conclude that
Python
On Sat, Mar 1, 2014 at 12:59 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
However, the example as given won't quite work. You never instantiate the
Idle etc. classes, which means the methods won't work. You need to make
them class methods or static methods, or perform some
On 2/28/14 8:08 PM, Mark H. Harris wrote:
On Friday, February 28, 2014 6:40:06 PM UTC-6, Ned Batchelder wrote:
I don't understand: you show an if/elif chain that cannot be expressed
as a switch statement (because it uses ), and then conclude that
Python needs a switch statement? That
Mark H. Harris wrote:
if (n**2 D(1)):
a = __atan__(n)
elif (n == D(1)):
a = gpi/4
elif (n == D(-1)):
a = -(gpi/4)
elif (n D(-1)):
a = __atan__Lt_neg1__(n)
else:
a = __atan__Gt_1__(n)
That's not a candidate for a switch statement,
On Sat, 01 Mar 2014 13:03:53 +1100, Chris Angelico wrote:
On Sat, Mar 1, 2014 at 12:59 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
However, the example as given won't quite work. You never instantiate
the Idle etc. classes, which means the methods won't work. You need to
On Friday, February 28, 2014 8:15:38 PM UTC-6, Ned Batchelder wrote:
Mark, if you are going to advocate for a feature, find a good use case,
this one is absurd. Where did the constants GT_1 etc, come from?
Not at all. Think of the C switch block... if you read about it in the K R
you'll
On Friday, February 28, 2014 8:01:45 PM UTC-6, Chris Angelico wrote:
Does your switch construct have to handle the magic of GT_1 meaning
1, or do you first figure out where it falls with an if/elif tree?
ChrisA
hi Chris, yeah... well think again of the switch block in C... the switch
On Sat, Mar 1, 2014 at 4:30 PM, Mark H. Harris harrismh...@gmail.com wrote:
hi Chris, yeah... well think again of the switch block in C... the switch
block selects a branch based on an integral number (int character) that is
generally a return code from a function. The function hides all
On Friday, February 21, 2014 12:37:59 AM UTC-6, Sam wrote:
I need to pass a global variable into a python function. However, the global
variable does not seem to be assigned after the function ends. Is it because
parameters are not passed by reference? How can I get function parameters to
On 2/27/14 8:24 AM, Mark H. Harris wrote:
As others have noted, python does not have a 'variable' concept (references to
objects instead) and so your question is a little ambiguous.
Mark, thanks for helping to answer the OP's question. We've covered (in
depth) in the rest of this thread,
On Thursday, February 27, 2014 11:54:44 AM UTC-6, Ned Batchelder wrote:
Mark, thanks for helping to answer the OP's question. We've covered (in
depth) in the rest of this thread, that Python *does* have the concept
of a variable, it just behaves differently than some other popular
On Thu, 27 Feb 2014 15:29:01 -0800, Mark H. Harris wrote:
Knowing that A points to an int, and
that B=A, now B points to the VERY SAME int... they are references
pointing to the same piece of memory. And of course we want new folks to
understand the issue of: A==B
True
A is B
False
On Thursday, February 27, 2014 8:07:20 PM UTC-6, Steven D'Aprano wrote:
If they point to the same piece of memory -- which, by the way, can be
moved around if the garbage collector supports it -- then A is B cannot
possibly return False.
hi Steve, long time, yes, my whole point
Mark H. Harris harrismh...@gmail.com writes:
So, yeah, thinking about variables is just not going away.
Right. I would like, ideally, for the Python documentation to avoid
mentioning that term entirely; and I would hope for that to promote a
better understanding of Python's data model.
The
On Fri, Feb 28, 2014 at 1:29 PM, Mark H. Harris harrismh...@gmail.com wrote:
a=1024
b=a
b=1024
a is b
False
No no no no! They're not pointing to the same integer any more. Now,
if you change the b=1024 from being a mostly-useless assignment (to
another int with the same value) into being a
On Thursday, February 27, 2014 10:43:23 PM UTC-6, Chris Angelico wrote:
Simple rule of thumb: Never use 'is' with strings or ints. They're
immutable, their identities should be their values. Playing with 'is'
will only confuse you, unless you're specifically going for
introspection and such.
On Fri, Feb 28, 2014 at 4:39 PM, Mark H. Harris harrismh...@gmail.com wrote:
On Thursday, February 27, 2014 10:43:23 PM UTC-6, Chris Angelico wrote:
Simple rule of thumb: Never use 'is' with strings or ints. They're
immutable, their identities should be their values. Playing with 'is'
will
Chris Angelico ros...@gmail.com:
Simple rule of thumb: Never use 'is' with strings or ints. They're
immutable, their identities should be their values. Playing with 'is'
will only confuse you, unless you're specifically going for
introspection and such.
Here's a use case for is with strings
Steven D'Aprano wrote:
Standard Pascal? Who uses standard Pascal? I'm talking about MacPascal :-)
Mac Pascal used @ for getting a pointer to
a variable, if I remember rightly.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
On 2014-02-26 10:59, Gregory Ewing wrote:
Steven D'Aprano wrote:
Standard Pascal? Who uses standard Pascal? I'm talking about MacPascal :-)
Mac Pascal used @ for getting a pointer to
a variable, if I remember rightly.
So did Turbo Pascal. Delphi, which is what Turbo Pascal became, is the
Steven D'Aprano wrote:
Yes, Pascal has pointers as a first-class data type. Syntax is similar to
C, ^x is a pointer to x, p^ dereferences the pointer p.
Actually, the prefix ^ is only used for declaring
pointer *types*. Standard Pascal has no way of getting
a pointer to an arbitrary variable;
Le lundi 24 février 2014 01:37:42 UTC+1, Steven D'Aprano a écrit :
Performance can matter :-)
timeit.timeit('abc' * 1000 + 'z')
0.991999136702321
timeit.timeit('abc' * 1000 + '\N{EURO SIGN}')
2.5462559386176444
Two points to notice
- Even with utf-8, the worse performance
On Mon, 24 Feb 2014 21:07:42 +1300, Gregory Ewing wrote:
Steven D'Aprano wrote:
Yes, Pascal has pointers as a first-class data type. Syntax is similar
to C, ^x is a pointer to x, p^ dereferences the pointer p.
Actually, the prefix ^ is only used for declaring pointer *types*.
Standard
On Sunday, February 23, 2014 5:01:25 AM UTC-6, Marko Rauhamaa wrote:
Chris Angelico ros...@gmail.com:
That's the exact line of thinking that leads to problems. You are not
placing a number at the address xyz, you are pointing the name xyz
to the number 3. That number still exists
On 02/24/2014 11:05 AM, j.e.ha...@gmail.com wrote:
typedef struct {
int value;
} Number;
Number *o;
o = malloc(sizeof(*o));
o-value=3;
printf(o%p, o-value%p\n, o, o-value);
o0x9fe5008, o-value0x9fe5008
Is the compiler borked?
Why would you think that? The address of the
On Mon, Feb 24, 2014, at 13:05, j.e.ha...@gmail.com wrote:
typedef struct {
int value;
} Number;
Number *o;
o = malloc(sizeof(*o));
o-value=3;
printf(o%p, o-value%p\n, o, o-value);
o0x9fe5008, o-value0x9fe5008
Is the compiler borked?
That's cheating. Try printf(o%p, o);
On Mon, Feb 24, 2014, at 13:19, Michael Torrie wrote:
Why would you think that? The address of the start of your malloc'ed
structure is the same as the address of the first element. Surely this
is logical? And of course all this is quite off topic.
That's not helpful - the problem, in
On Tue, Feb 25, 2014 at 5:05 AM, j.e.ha...@gmail.com wrote:
typedef struct {
int value;
} Number;
Number *o;
o = malloc(sizeof(*o));
o-value=3;
printf(o%p, o-value%p\n, o, o-value);
o0x9fe5008, o-value0x9fe5008
Is the compiler borked?
No, because a structure in C is simply
On Tue, Feb 25, 2014 at 5:20 AM, random...@fastmail.us wrote:
On Mon, Feb 24, 2014, at 13:05, j.e.ha...@gmail.com wrote:
typedef struct {
int value;
} Number;
Number *o;
o = malloc(sizeof(*o));
o-value=3;
printf(o%p, o-value%p\n, o, o-value);
o0x9fe5008, o-value0x9fe5008
Is
On 24/02/2014 18:05, j.e.ha...@gmail.com wrote:
On Sunday, February 23, 2014 5:01:25 AM UTC-6, Marko Rauhamaa wrote:
Chris Angelico ros...@gmail.com:
That's the exact line of thinking that leads to problems. You are not
placing a number at the address xyz, you are pointing the name xyz
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
The big difference is that in fixed location languages, it makes
sense to talk about the address of a *variable*.
The address could be a symbol, too.
The Python statement
xyz = 3
places a number in the address xyz.
You can read the
On Sun, Feb 23, 2014 at 8:52 PM, Marko Rauhamaa ma...@pacujo.net wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
The big difference is that in fixed location languages, it makes
sense to talk about the address of a *variable*.
The address could be a symbol, too.
The Python
On Sun, 23 Feb 2014 11:52:05 +0200, Marko Rauhamaa wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
The big difference is that in fixed location languages, it makes
sense to talk about the address of a *variable*.
The address could be a symbol, too.
The Python statement
Chris Angelico ros...@gmail.com:
That's the exact line of thinking that leads to problems. You are not
placing a number at the address xyz, you are pointing the name xyz
to the number 3. That number still exists elsewhere.
And?
In C, I can say:
Number *o = malloc(sizeof *o);
o-value =
On Sun, Feb 23, 2014 at 10:01 PM, Marko Rauhamaa ma...@pacujo.net wrote:
As for Python, there's nothing in the Python specification that would
prevent you from having, say, 63-bit integers as representing
themselves. IOW, you could physically place such integers as themselves
as the reference
Chris Angelico ros...@gmail.com:
On Sun, Feb 23, 2014 at 10:01 PM, Marko Rauhamaa ma...@pacujo.net wrote:
As for Python, there's nothing in the Python specification that would
prevent you from having, say, 63-bit integers as representing
themselves. IOW, you could physically place such
On Mon, Feb 24, 2014 at 2:24 AM, Marko Rauhamaa ma...@pacujo.net wrote:
Or id(n) == 2 ** 64 + n for 63-bit integers; other objects get the
RAM address of the internal ḿemory block:
id(5)
18446744073709551621
id([])
3074657068
id(id([]))
18446744076784207372
Assuming
On 2/23/2014 6:01 AM, Marko Rauhamaa wrote:
As for Python, there's nothing in the Python specification that would
prevent you from having, say, 63-bit integers as representing
themselves. IOW, you could physically place such integers as themselves
as the reference and the number would not
Chris Angelico ros...@gmail.com:
id() is (if I recall correctly) supposed to return an integer in the
native range
That restriction seems beyond the scope of the language definition.
Still, it can be trivially provided for.
In any case, you'd need some way to pretend that every integer is
Terry Reedy tjre...@udel.edu:
Special-casing ints to store the value in the reference has been
proposed and rejected. I do not remember how far anyone went in trying
to code the idea, but I doubt that anyone got as far as getting the
test suite to pass.
FWIW, elisp essentially does that.
On 23/02/2014 21:04, Marko Rauhamaa wrote:
And thus, Python variables are barely distinguishable from C variables.
To repeat what Terry Reedy said earlier, hogwash. Looks as if I've
another member of my dream team, who can proudly sit alongside our self
appointed resident unicode expert.
On Sun, 23 Feb 2014 23:10:36 +0200, Marko Rauhamaa wrote:
Terry Reedy tjre...@udel.edu:
Special-casing ints to store the value in the reference has been
proposed and rejected. I do not remember how far anyone went in trying
to code the idea, but I doubt that anyone got as far as getting the
# a swapping variant
def swap(a, b):
... ab = [a, b]
... ab[1], ab[0] = ab[0], ab[1]
... return ab[0], ab[1]
...
a = 111
id(a)
505627864
b = 999
id(b)
58278640
a, b = swap(a, b)
a, id(a)
(999, 58278640)
b, id(b)
(111, 505627864)
jmf
--
On Sat, Feb 22, 2014 at 7:02 PM, wxjmfa...@gmail.com wrote:
# a swapping variant
def swap(a, b):
... ab = [a, b]
... ab[1], ab[0] = ab[0], ab[1]
... return ab[0], ab[1]
Provably identical to:
def swap(a, b):
return b, a
The rest is just fluff.
ChrisA
--
Le samedi 22 février 2014 09:10:02 UTC+1, Chris Angelico a écrit :
On Sat, Feb 22, 2014 at 7:02 PM, wxjmfa...@gmail.com wrote:
# a swapping variant
def swap(a, b):
... ab = [a, b]
... ab[1], ab[0] = ab[0], ab[1]
... return ab[0], ab[1]
Provably identical
On Sat, 22 Feb 2014 19:10:02 +1100, Chris Angelico wrote:
On Sat, Feb 22, 2014 at 7:02 PM, wxjmfa...@gmail.com wrote:
# a swapping variant
def swap(a, b):
... ab = [a, b]
... ab[1], ab[0] = ab[0], ab[1]
... return ab[0], ab[1]
Provably identical to:
def swap(a, b):
On Sat, 22 Feb 2014 18:29:02 +1100, Chris Angelico wrote:
On Sat, Feb 22, 2014 at 6:18 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Now I daresay that under the hood, Pascal is passing the address of foo
(or bar) to the procedure plus, but inside plus you don't see that
On Sat, Feb 22, 2014 at 7:35 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Yep. I should have clarified that I wasn't talking about Pascal; I'm not
fluent in the language (last time I did anything at all with Pascal was
probably about ten years ago, and not much then). In C,
On Sat, 22 Feb 2014 09:28:10 +0200, Marko Rauhamaa wrote:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info:
But your code doesn't succeed at doing what it sets out to do. If you
try to call it like this:
py x = 23
py y = 42
py swap(x, y)
Traceback (most recent call last):
File
On Sat, Feb 22, 2014 at 7:45 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
But why bother to write C in Python? Python makes a really bad C, and C
makes a really bad Python.
+1.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On 22/02/2014 02:47, Dennis Lee Bieber wrote:
BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for an
address [a box that holds things].
In C.
int xyz = 1;
xyz is placed in a register. What is xyz called now as it's not in memory?
--
My fellow Pythonistas, ask not what
Mark Lawrence breamore...@yahoo.co.uk:
On 22/02/2014 02:47, Dennis Lee Bieber wrote:
BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym
for an address [a box that holds things].
In C.
int xyz = 1;
xyz is placed in a register. What is xyz called now as it's not in
memory?
Mark Lawrence breamore...@yahoo.co.uk Wrote in message:
On 22/02/2014 02:47, Dennis Lee Bieber wrote:
BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for an
address [a box that holds things].
In C.
int xyz = 1;
xyz is placed in a register. What is xyz called now as
On Sat, 22 Feb 2014 13:03:33 -0500, Dennis Lee Bieber wrote:
As I recall, to handle garbage collection, Apple used to use two stage
look ups... The user variable (handle) was a reference into a table of
handles, and each entry in that table was a reference to the real object
out in memory.
On Sat, 22 Feb 2014 14:15:22 +, Mark Lawrence wrote:
On 22/02/2014 02:47, Dennis Lee Bieber wrote:
BASIC, C, FORTRAN, COBOL, Assembly... A variable is synonym for
an address [a box that holds things].
In C.
int xyz = 1;
xyz is placed in a register. What is xyz called
On Sun, Feb 23, 2014 at 12:39 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
In C or Pascal-style languages, what we might call the fixed address
style of variables, a variable assignment like xyz = 1 does something
like this:
- associate the name 'xyz' with some fixed
On Sun, 23 Feb 2014 12:50:26 +1100, Chris Angelico wrote:
On Sun, Feb 23, 2014 at 12:39 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
In C or Pascal-style languages, what we might call the fixed address
style of variables, a variable assignment like xyz = 1 does something
On Sun, Feb 23, 2014 at 5:20 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
The important thing here is not so much that we are disagreeing, but that
we are talking about two different levels of explanation. (Gödel, Escher
And Bach has an very interesting section about how
On 02/20/2014 10:37 PM, Sam wrote:
I need to pass a global variable into a python function. However, the global
variable does not seem to be assigned after the function ends. Is it because
parameters are not passed by reference? How can I get function parameters to be
passed by reference in
On Thu, 20 Feb 2014 22:37:59 -0800, Sam wrote:
I need to pass a global variable into a python function. However, the
global variable does not seem to be assigned after the function ends. Is
it because parameters are not passed by reference? How can I get
function parameters to be passed by
dieter writes:
Sam writes:
I need to pass a global variable into a python function.
Python does not really have the concept variable.
What appears to be a variable is in fact only the binding of an
object to a name. If you assign something to a variable,
all you do is binding a
Jussi Piitulainen jpiit...@ling.helsinki.fi:
In alleged contrast, the observable behaviour of languages that have
variables is the same. This is not considered confusing by the people
who insist that there are no variables in Python.
But of course there are variables in Python:
By
On 2/21/14 2:23 AM, dieter wrote:
Samlightai...@gmail.com writes:
I need to pass a global variable into a python function.
Python does not really have the concept variable.
What appears to be a variable is in fact only the binding of an
object to a name. If you assign something to a
Ned Batchelder n...@nedbatchelder.com:
Man, do I hate this idea that Python has no variables. It has
variables (names associated with values, and the values can change
over the course of the program),
In classic functional programming, the values of variables can't change
but they are still
On Feb 21, 2014, at 4:13 AM, Ned Batchelder n...@nedbatchelder.com wrote:
Man, do I hate this idea that Python has no variables. It has variables
(names associated with values, and the values can change over the course of
the program), they just don't work the same as C or Fortran
On Sat, Feb 22, 2014 at 4:59 AM, Travis Griggs travisgri...@gmail.com wrote:
What makes Python
variables/bindings/references/aliases/namedvalues/slots/bucketsofstuff
surprising to new arrivals from other language kingdoms, is that accessing is
pragmatically implicit (walks the scope tree
On the question of how variables can be passed to functions, C, of
course, has the operator and Pascal has the var keyword.
An analogous thing can be achieved in Python 3 (but not in Python 2, I'm
afraid). The operator corresponds to an ad hoc property class as in
the program below (not
Ned Batchelder n...@nedbatchelder.com writes:
On 2/21/14 2:23 AM, dieter wrote:
Samlightai...@gmail.com writes:
I need to pass a global variable into a python function.
Python does not really have the concept variable.
What appears to be a variable is in fact only the binding of an
101 - 200 of 212 matches
Mail list logo