On 2015-05-07 20:45, Dave Angel wrote:
You also only showed it working on module globals. (For code at
top-level, locals() returns the same as globals() )
You could also try it inside functions, where locals() really makes
sense as a name. And you could try it in a nested function where
there
On 05/07/2015 11:23 PM, Alex Kleider wrote:
On 2015-05-07 19:10, Dave Angel wrote:
def get_name(localmap, item):
"""As suggested.
Returns 'a' name, not necessarily 'the' name."""
for name in localmap:
if localmap[name] == item:
This is not likely to be what was intende
On 2015-05-07 19:10, Dave Angel wrote:
def get_name(localmap, item):
"""As suggested.
Returns 'a' name, not necessarily 'the' name."""
for name in localmap:
if localmap[name] == item:
This is not likely to be what was intended. You want
if localmap[name] is
Howdy all,
I just received a private message that, briefly and simply, thanked me
for advice I gave in this forum, explaining specifically how it helped
the recipient understand a concept better.
It made my day; I have a spring in my step now.
Everyone, never hesitate to thank someone – privatel
On Thu, May 07, 2015 at 12:15:42PM -0700, Jim Mooney Py3.4.3winXP wrote:
> I find this a bit confusing. Since the ID of K remains the same, so it's
> the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I
> understand that it's immutable but doesn't that mean K is created each time
On 05/07/2015 09:50 PM, Alex Kleider wrote:
On 2015-04-21 16:48, Cameron Simpson wrote:
But it would not be schizophrenic to write a function that returned a
name arbitrarily, by inspecting locals(). It depends whether you only
need a name, or if you need "the" name.
Write yourself a "find_nam
On 2015-04-21 16:48, Cameron Simpson wrote:
But it would not be schizophrenic to write a function that returned a
name arbitrarily, by inspecting locals(). It depends whether you only
need a name, or if you need "the" name.
Write yourself a "find_name_from_locals(local_map, value)" function
tha
On 05/07/2015 07:51 PM, Dave Angel wrote:
On 05/07/2015 04:54 PM, Jim Mooney Py3.4.3winXP wrote:
On 7 May 2015 at 13:03, Emile van Sebille wrote:
Compare to:
def testid(K=100):
K += 10
return 'the ID is', id(K), K
Ah, thanks. I forgot small integers are saved in a table. I
On 05/07/2015 05:25 PM, Alan Gauld wrote:
On 07/05/15 21:54, Jim Mooney Py3.4.3winXP wrote:
Ah, thanks. I forgot small integers are saved in a table. I was
looking at
a demo that pointers to defaults in function parameters are persistent.
But remember they variables are NOT pointers.
They are
On 05/07/2015 04:54 PM, Jim Mooney Py3.4.3winXP wrote:
On 7 May 2015 at 13:03, Emile van Sebille wrote:
Compare to:
def testid(K=100):
K += 10
return 'the ID is', id(K), K
Ah, thanks. I forgot small integers are saved in a table. I was looking at
a demo that pointers to def
On 05/07/2015 03:15 PM, Jim Mooney Py3.4.3winXP wrote:
I find this a bit confusing. Since the ID of K remains the same, so it's
the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I
understand that it's immutable but doesn't that mean K is created each time
in local scope so it
On 05/07/2015 04:03 PM, Emile van Sebille wrote:
On 5/7/2015 12:15 PM, Jim Mooney Py3.4.3winXP wrote:
I find this a bit confusing. Since the ID of K remains the same, so it's
the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I
understand that it's immutable but doesn't that m
On 07/05/15 21:54, Jim Mooney Py3.4.3winXP wrote:
Ah, thanks. I forgot small integers are saved in a table. I was looking at
a demo that pointers to defaults in function parameters are persistent.
But remember they variables are NOT pointers.
They are keys in a dictionary. Very different.
Als
On 7 May 2015 at 13:03, Emile van Sebille wrote:
> Compare to:
>
> def testid(K=100):
> K += 10
> return 'the ID is', id(K), K
>
Ah, thanks. I forgot small integers are saved in a table. I was looking at
a demo that pointers to defaults in function parameters are persistent. It
use
On 5/7/2015 12:15 PM, Jim Mooney Py3.4.3winXP wrote:
I find this a bit confusing. Since the ID of K remains the same, so it's
the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I
understand that it's immutable but doesn't that mean K is created each time
in local scope so it sh
I find this a bit confusing. Since the ID of K remains the same, so it's
the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I
understand that it's immutable but doesn't that mean K is created each time
in local scope so it should have a different ID each time?
def testid(K=10):
Stewart Lawton writes:
> Hi I have tried Python TCPIP sockets and Unix sockets processed in a
> python cgi script, called from apache under fedora19. In both cases a
> permissions error is returned at sock.connect(). I have tried changing
> permissions x and r w on ALL of user, group, other to no
Can you post again in plain text? The formatting below
is all messed up, indentation and spacing errors abound.
On 07/05/15 11:56, Stewart Lawton wrote:
Hi I have tried Python TCPIP sockets and Unix sockets
> processed in a python cgi script,
Have you tried opening the same sockets in a script
Hi I have tried Python TCPIP sockets and Unix sockets processed in a python cgi
script, called from apache under fedora19. In both cases a permissions error is
returned at sock.connect(). I have tried changing permissions x and r w on ALL
of user, group, other to no avail. In both cases the cgi
On 07/05/15 05:09, Ikaia Leleiwi wrote:
number might be. If the guess is lower then the inputted number then the
user inputs the word 'higher' to indicate the computer needs to guess a
higher number. If the guess is higher than the inputted number then the
user inputs the word 'lower' to indic
I am having trouble writing a program that guesses a number inputted by the
user. A number between 1-100 is inputted into the program and the computer
produces a random integer that is the "guess" as to what the inputted
number might be. If the guess is lower then the inputted number then the
use
>
> This is what was also confusing as well. I assumed that python stored
> objects rather than simply assigning them.
>
On Tue, May 5, 2015 at 4:48 AM, Alan Gauld
wrote:
> On 05/05/15 05:29, Brandon D wrote:
>
>> Hello tutors,
>>
>> I'm having trouble understanding, as well as visualizing, how
Thanks Steven. I was just confused on the execution of when Python
destroys objects that are no long bound or referenced.
On Tue, May 5, 2015 at 2:00 PM, Steven D'Aprano wrote:
> On Tue, May 05, 2015 at 12:29:59AM -0400, Brandon D wrote:
> > Hello tutors,
> >
> > I'm having trouble understandin
23 matches
Mail list logo