Bernd Nawothnig wrote:
You're thinking you're passing the arguments as reference
That is the way Fortran handles them:
which is one of the things you really love when you link against
underdocumented Fortran programs from C. (is that parameter
a scalar or an array? crash! oh, an array. how
On Sun, 15 May 2005 08:00:47 +0200, Fredrik Lundh [EMAIL PROTECTED] wrote:
M.E.Farmer wrote:
I said exactly what I meant, the parentheses around the values creates
a tuple that you have no reference to!
repeating it doesn't make you right; no extra tuple is created, and the
parens are part of
No. You claimed
quote
This will only create a tuple in memory
/quote
That is not what I said please do not edit my words and call it a
quote!
But we just learned that this is not the case.
Yes it seems I was proven wrong and have learned much from the
discussion ;)
That is why I am here to learn
Fredrik and Bengt:
Thank you for the time.
I will study the docs and play with the shell till this is firm.
M.E.Farmer
--
http://mail.python.org/mailman/listinfo/python-list
It looks like the docs could use some examples of the various
assignments it refers to.
I think something like Bengt posted would be a nice addition if it
included assignments with slices and dicts too.
Just a thought.
M.E.Farmer
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-05-14, David wrote:
abc(x,y,dotp,sumx,maxv)
(x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv)
Bernd
--
Those who desire to give up freedom in order to gain security,
will not have, nor do they deserve, either one. [T. Jefferson]
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
You're thinking you're passing the arguments as reference (look at mutable
vs non-mutable)
Your function returns the values in a tupple (x,y,...); you need to fetch
the values from that tupple
Regards,
Philippe
David wrote:
Hi I'm trying to teach myself python and so far to good,
On 2005-05-14, Philippe C. Martin wrote:
You're thinking you're passing the arguments as reference
That is the way Fortran handles them:
[...]
Right now I'm taking a simple program I wrote in Fortran
Bernd
--
Those who desire to give up freedom in order to gain security,
will not have,
David wrote:
Hi I'm trying to teach myself python and so far to good, but I'm
having
a bit of trouble getting a function to work the way I think it should
work. Right now I'm taking a simple program I wrote in Fortran and
trying to do it in Python. I got it to work, but now I'm trying to
(x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv)
This will only create a tuple in memory that has no name to reference
it by!
How would you access the returned value?
If you want a tuple you need to assign all the return vales to a single
name.
mytup = abc(x,y,dotp,sumx,maxv)
M.E.Farmer
--
M.E.Farmer wrote:
(x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv)
This will only create a tuple in memory that has no name to reference
it by!
Huh? This binds the names x, y, dotp, sumx and maxv to the
values returned by abc:
py def abc(*args):
... return args
...
py (x,y,dotp,sumx,maxv)
Thank you very much. Tulpes are really neat now that I've looked at
them. So after just fixing it, I changed it up and I would like to
show it off now.
#! /usr/bin/python
#This program takes two vectors and multiplies them
#against a 10X10 array. It also then gives the dot product,
#sum, and
Hmm don't know what happened. I guess the formatting got all chewed up.
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-05-14, M.E.Farmer wrote:
(x,y,dotp,sumx,maxv) = abc(x,y,dotp,sumx,maxv)
This will only create a tuple in memory that has no name to reference
it by!
Maybe. But it does not seem to hurt. And I am not sure the tupel _is_
really created in that situation.
How would you access the
Yes, I gathered.
We all get our habits from somewhere :-)
Regards,
Philippe
Bernd Nawothnig wrote:
On 2005-05-14, Philippe C. Martin wrote:
You're thinking you're passing the arguments as reference
That is the way Fortran handles them:
[...]
Right now I'm taking a simple program
I said exactly what I meant, the parentheses around the values creates
a tuple that you have no reference to! It also has a side effect of
binding the names inside the tuple to a value and placing them in the
local namespace( implicit tuple unpacking ). It might be the same as
no parens but it
I said exactly what I meant, the parantheses around the values creates
a tuple that you have no reference to! It also has a side effect of
binding the names inside the tuple to a value and placing them in the
local namespace. It might be the same but it isn't very clear. If you
want a tuple make
M.E.Farmer wrote:
I said exactly what I meant, the parentheses around the values creates
a tuple that you have no reference to! It also has a side effect of
binding the names inside the tuple to a value and placing them in the
local namespace( implicit tuple unpacking ). It might be the same
Steven Bethard wrote:
I don't know the implementation enough to know whether or not a tuple is
actually created when b and c are bound to their values, but I'd be
willing to bet that whatever happens to (b, c) is exactly the same as
what happens to b, c.
Some corroborating evidence:
py
On 14 May 2005 10:44:30 -0700, M.E.Farmer [EMAIL PROTECTED] wrote:
[...]
Be sure to study up on namespaces, it will ease your Python woes.
Namespaces are the most fundamental part of Python that new users don't
understand. Namespace mastery will take you far.
Just remember there are only two
On 14 May 2005 13:25:55 -0700, M.E.Farmer [EMAIL PROTECTED] wrote:
I said exactly what I meant, the parentheses around the values creates
a tuple that you have no reference to! It also has a side effect of
I don't understand what you are saying, or meaning ;-)
BTW, the function call has nothing
It actually is the same, and I don't think implicit or explicit is the
difference you should be citing here.
Why not it is relevant and true that Python is doing an implicit
unpacking of the values in that unnamed tuple.
Quoting myself It might be the same as
no parens but it isn't very clear. If
I explained what i meant in previous post there was nothing more than
just a discussion I have no real problem here just more of a sore point
in style for me. I feel that parens are quite overloaded and it can be
confusing to newbies.
But if the parens are just fluff then get rid of them, it is
M.E.Farmer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
But if the parens are just fluff then get rid of them, it is clearer *
at least to me * ;)
While I find unnecessary parens on the right of '=' tolerable, I agree as
to the style preference.
Terry J. Reedy
--
24 matches
Mail list logo