Re: Python Args By Reference

2005-05-11 Thread Steve Holden
Fredrik Lundh wrote: > Grant Edwards wrote: > > >>Yes. All arguments are passed by reference. This must be in >>the FAQ somewhere... > > > hopefully not, because that saying that "all arguments are passed > by reference" is extremely confusing for people who've learned about > "call by refere

Re: Python Args By Reference

2005-05-11 Thread Terry Reedy
"ncf" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Example C Code: > #define P(a,b,c,d,e,f,g,h,x,K) \ > { \ > temp1 = h + S3(e) + F1(e,f,g) + K + x; \ > temp2 = S2(a) + F0(a,b,c); \ > d += temp1; h = temp1 + temp2; \ > } > Python Code: > def P(a,b,c,d,e,f,g,h,x,K): >temp1 =

Re: Python Args By Reference

2005-05-11 Thread Fredrik Lundh
Grant Edwards wrote: > Yes. All arguments are passed by reference. This must be in > the FAQ somewhere... hopefully not, because that saying that "all arguments are passed by reference" is extremely confusing for people who've learned about "call by reference" in school. as has discussed many

Re: Python Args By Reference

2005-05-11 Thread Terry Hancock
On Wednesday 11 May 2005 08:43 am, Peter Hansen wrote: > Roy Smith wrote: > > The most common immutable objects you'll see are strings and tuples, and > > the main reason they're immutable is to allow them to be dict keys. > > And ints. Strings, tuples and ints are the *three* most common > imm

Re: Python Args By Reference

2005-05-11 Thread ncf
Thanks to everyone for your assistance. I shall reread this a couple times and then try to make something that works. Many thanks and have a GREAT day. -Wes -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Args By Reference

2005-05-11 Thread Grant Edwards
On 2005-05-11, Peter Hansen <[EMAIL PROTECTED]> wrote: >> The most common immutable objects you'll see are strings and >> tuples, and the main reason they're immutable is to allow them >> to be dict keys. > > And ints. Strings, tuples and ints are the *three* most > common immutable objects you'l

Re: Python Args By Reference

2005-05-11 Thread Grant Edwards
On 2005-05-11, Roy Smith <[EMAIL PROTECTED]> wrote: > The most common immutable objects you'll see are strings and tuples, And integers. They're immutable, aren't they? At least the small ones. And floats. -- Grant Edwards grante Yow! .. bleakness

Re: Python Args By Reference

2005-05-11 Thread Peter Hansen
Roy Smith wrote: > The most common immutable objects you'll see are strings and tuples, and > the main reason they're immutable is to allow them to be dict keys. And ints. Strings, tuples and ints are the *three* most common immutable objects you'll see... -Peter -- http://mail.python.org/mai

Re: Python Args By Reference

2005-05-11 Thread Roy Smith
"ncf" <[EMAIL PROTECTED]> wrote: > The two issues I am having in grasping all of this are as follows: > 1) Being new to Python, terms like mutable and immutable. Although I > have probably dealt with them in other languages, the terms by > themselves are a little confusing, but managable overall, s

Re: Python Args By Reference

2005-05-10 Thread Donn Cave
Quoth "ncf" <[EMAIL PROTECTED]>: ... | The two issues I am having in grasping all of this are as follows: | 1) Being new to Python, terms like mutable and immutable. Although I | have probably dealt with them in other languages, the terms by | themselves are a little confusing, but managable overal

Re: Python Args By Reference

2005-05-10 Thread Dan Bishop
ncf wrote: > As I fail to see how an array could be used in this (my own > stupidity?), would you have any such example? For reference, I'm trying > to translate this: http://www.cr0.net:8040/code/crypto/sha256/ (Inside > sha256_process). > > Once again, thanks for the patience, I'm still picking u

Re: Python Args By Reference

2005-05-10 Thread Paul Rubin
Paul Rubin writes: > state = [A,B,C,D,E,F,G,H] > magic = [0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, > 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98 ] > > def P(state, i, magic): >a,b,c,d,e,f,g,h = state[i:] + state[:i]

Re: Python Args By Reference

2005-05-10 Thread Paul Rubin
"ncf" <[EMAIL PROTECTED]> writes: > As I fail to see how an array could be used in this (my own > stupidity?), would you have any such example? How's this (untested): state = [A,B,C,D,E,F,G,H] magic = [0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1,

Re: Python Args By Reference

2005-05-10 Thread ncf
As I fail to see how an array could be used in this (my own stupidity?), would you have any such example? For reference, I'm trying to translate this: http://www.cr0.net:8040/code/crypto/sha256/ (Inside sha256_process). Once again, thanks for the patience, I'm still picking up on all the little ti

Re: Python Args By Reference

2005-05-10 Thread Paul Rubin
"ncf" <[EMAIL PROTECTED]> writes: > Since I cannot simply do it the way I had originally seen it, would > there be an alternative method to proforming the operations that I am > missing? Use an array instead of all those named variables. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Args By Reference

2005-05-10 Thread ncf
Ok, I'm relatively new to python (< 1 year experiance), yet I have had much experiance with other languages. I never really looked that deeply in the FAQ -- temporary lapse of stupidity(?). Thanks for the link, the concept seems to help. The two issues I am having in grasping all of this are as f

Re: Python Args By Reference

2005-05-10 Thread Grant Edwards
On 2005-05-10, Joseph Garvin <[EMAIL PROTECTED]> wrote: > ncf wrote: > >>Hello all, I was wondering if there was any way to pass arguments >>(integer and such) by reference (address of), rather than by value. > > All mutable types in python are passed by reference automatically. So are immutable o

Re: Python Args By Reference

2005-05-10 Thread Dan Bishop
Joseph Garvin wrote: > ncf wrote: > > >Hello all, I was wondering if there was any way to pass arguments > >(integer and such) by reference (address of), rather than by value. > > > >Many thanks in advance. > > > > All mutable types in python are passed by reference automatically. More accurately:

Re: Python Args By Reference

2005-05-10 Thread Grant Edwards
On 2005-05-10, ncf <[EMAIL PROTECTED]> wrote: > Hello all, I was wondering if there was any way to pass arguments > (integer and such) by reference (address of), rather than by value. Yes. All arguments are passed by reference. This must be in the FAQ somewhere... Sure enough. 30 seconds of b

Re: Python Args By Reference

2005-05-10 Thread Joseph Garvin
ncf wrote: >Hello all, I was wondering if there was any way to pass arguments >(integer and such) by reference (address of), rather than by value. > >Many thanks in advance. > >-Wes > > > All mutable types in python are passed by reference automatically. -- http://mail.python.org/mailman/listi

Python Args By Reference

2005-05-10 Thread ncf
Hello all, I was wondering if there was any way to pass arguments (integer and such) by reference (address of), rather than by value. Many thanks in advance. -Wes -- http://mail.python.org/mailman/listinfo/python-list