>>> # 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
--
https://
On Sat, Feb 22, 2014 at 7:02 PM, 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
--
https://mail.python.org/ma
Le samedi 22 février 2014 09:10:02 UTC+1, Chris Angelico a écrit :
> On Sat, Feb 22, 2014 at 7:02 PM, 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 identi
On Sat, 22 Feb 2014 19:10:02 +1100, Chris Angelico wrote:
> On Sat, Feb 22, 2014 at 7:02 PM, 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
> 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
>> address as the value of b. You
On Sat, Feb 22, 2014 at 7:35 PM, Steven D'Aprano
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, it strictly does
>> what I said:
On Sat, 22 Feb 2014 09:28:10 +0200, Marko Rauhamaa wrote:
> Steven D'Aprano :
>
>> 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 "", line 1, in
>>
On Sat, Feb 22, 2014 at 7:45 PM, Steven D'Aprano
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
I have been reading the argparse section of the 3.3 docs, and running all the
example code.
But in section 16.4.2.6. for the formatter_class, the second example in that section
illustrating RawDescriptionHelpFormatter, the example code is:
parser = argparse.ArgumentParser(
prog='PROG',
I'm poking around in the stdlib, and Lib/mailbox.py has the following
inside class Mailbox:
def update(self, arg=None):
"""Change the messages that correspond to certain keys."""
if hasattr(arg, 'iteritems'):
source = arg.items()
elif hasattr(arg, 'items'):
Chris Angelico wrote:
> Heavy computation might be unideal in Python, but if you can grunge it
> into NumPy operations, that won't be a problem.
May take a look to Pythran too, which generate C++ code from (limited subset
of) Python code, usable as a Python compiled module or as standalone C++.
Chris Angelico wrote:
> I'm poking around in the stdlib, and Lib/mailbox.py has the following
> inside class Mailbox:
>
> def update(self, arg=None):
> """Change the messages that correspond to certain keys."""
> if hasattr(arg, 'iteritems'):
> source = arg.items()
Larry Hudson wrote:
> I have been reading the argparse section of the 3.3 docs, and running all
> the example code.
>
> But in section 16.4.2.6. for the formatter_class, the second example in
> that section illustrating RawDescriptionHelpFormatter, the example code
> is:
>
> parser = argparse.Ar
On Sat, Feb 22, 2014 at 10:54 PM, Peter Otten <__pete...@web.de> wrote:
> Please file a bug report.
http://bugs.python.org/issue20729 created.
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
==
>BREAKING NEWS
==
>
SMITHSONIAN FINALLY SHUT DOWN AFTER YEARS OF CENSORSHIP, SCAMS AND CON
ARTISTRY.
>
THRINAXODON BLEW DOWN THE BUILDINGS, LIT IT ON FIRE AND HAD THE ASSHOLES
ARRESTED.
>
R. DAWKINS WAS THROWN IN THE DOGHOUSE, ONLY TO GET KILLED BY ANGRY
FELONS WHO
Mark Lawrence :
> 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?
It's still
On 02/21/2014 09:59 PM, Denis Usanov wrote:
Good evening.
First of all I would like to apologize for the name of topic. I really didn't
know how to name it more correctly.
I mostly develop on Python some automation scripts such as deployment (it's not about
fabric and may be not ssh at all),
Mark Lawrence 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 it's not
==
>BREAKING NEWS
==
>
THRINAXODON JUST BEAT RICHARD LEAKEY 100-0 IN WORLD SCIENCE
CHAMPIONSHIP. LEAKEY WAS TRYING WITH ALL HIS MIGHT TO PROVE HUMAN'S
QUATERNARY ORIGINS, BUT THRINAXODON DEFEATED HIM WITH A FEW HUMAN
DEVONIAN FOSSILS.
>
THE FOSSILS WERE EXACT,
Let's open a group for Wheezy.web. I'm just wondering which forum site to
choose? Any suggestions?
--
https://mail.python.org/mailman/listinfo/python-list
https://groups.google.com/forum/#!forum/wheezyweb
Here's a forum. I am not sure where this will lead, but maybe we need it in the
future.
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, Feb 23, 2014 at 8:48 AM, wrote:
> Let's open a group for Wheezy.web. I'm just wondering which forum site to
> choose? Any suggestions?
If you want to discuss something serious, use a Mailman list.
Everywhere I go, Mailman lists have high signal-to-noise ratios,
higher than pretty much e
On 02/22/2014 12:04 PM, Dennis Lee Bieber wrote:
> Except he did state "... in the web browser ...", so I responded on
> that side...
You're right of course. Sorry about that. I kind of wondered why he
was asking when R does the job.
>
> Apparently "shiny" is rather new... It isn't
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.
Is there a way to make sure that whenever you're making google engine app
iterations to a database that that info does not get wiped/deleted. Please
advise
--
https://mail.python.org/mailman/listinfo/python-list
On 23/02/2014 00:39, glenn.a.is...@gmail.com wrote:
Is there a way to make sure that whenever you're making google engine app
iterations to a database that that info does not get wiped/deleted. Please
advise
What Python code have you tried or are you contemplating using?
--
My fellow Pytho
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
On Sun, Feb 23, 2014 at 12:39 PM, Steven D'Aprano
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 location
> - stuff the value 1 into
On Feb 21, 2014, at 9:30 PM, Dave Angel wrote:
You’re awesome David! Thanks for taking the time to not only help answer my
question but helping me to understand it as well!!
Scott
--
https://mail.python.org/mailman/listinfo/python-list
My understanding of Python tuples is that they are like immutable lists. If
this is the cause, why can't we replace tuples with lists all the time (just
don't reassign the lists)? Correct me if I am wrong.
--
https://mail.python.org/mailman/listinfo/python-list
Sam writes:
> My understanding of Python tuples is that they are like immutable
> lists. If this is the cause, why can't we replace tuples with lists
> all the time (just don't reassign the lists)?
You can do that a lot of the time but not always. For example, you can
use a tuple as a dictionar
On Sun, Feb 23, 2014 at 3:06 PM, Sam wrote:
> My understanding of Python tuples is that they are like immutable lists. If
> this is the cause, why can't we replace tuples with lists all the time (just
> don't reassign the lists)? Correct me if I am wrong.
>
One reason is performance/efficiency.
Sam writes:
> My understanding of Python tuples is that they are like immutable
> lists.
That's a common expression, but I think it's not a helpful way to think
of them.
Rather, the different sequence types have different semantic purposes:
* For representing a sequence where each item means e
On 02/22/2014 03:58 AM, Peter Otten wrote:
Larry Hudson wrote:
I have been reading the argparse section of the 3.3 docs, and running all
the example code.
But in section 16.4.2.6. for the formatter_class, the second example in
that section illustrating RawDescriptionHelpFormatter, the example
On Sun, 23 Feb 2014 12:50:26 +1100, Chris Angelico wrote:
> On Sun, Feb 23, 2014 at 12:39 PM, Steven D'Aprano
> 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
On Sun, Feb 23, 2014 at 5:20 PM, Steven D'Aprano
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 explanations at
> different levels c
Hello,
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a way I
can call a function and then add *5 or something like that?
Thanks for any help!
Scott
--
https://mail.python.org/mailman/listinfo/pytho
38 matches
Mail list logo