On 01/04/2014 06:36 AM, Steven D'Aprano wrote:
Now, it's true that when *debugging code*, being able to see the name of
the variable and the contents of the variable is useful. But in ordinary
code, why would you care to print the name of the variable and its
contents. Who cares what the variable
On Fri, Jan 03, 2014 at 01:55:29AM -0500, Keith Winston wrote:
[...]
> I want to iterate through a bunch of lists, subsequently printing both list
> members (via indexing, for example) and the name of the list I'm on.
Why? What does this gain you?
Now, it's true that when *debugging code*, being
On Fri, Jan 03, 2014 at 02:45:04AM -0500, Keith Winston wrote:
> And to beat that poor horse in the same example, my current way of doing
> that would be:
>
> for alist in "lista", "listb":
> print(alist, eval(alist))
Since you know both pieces, namely the name of the entity "alist" and its
And to beat that poor horse in the same example, my current way of doing
that would be:
for alist in "lista", "listb":
print(alist, eval(alist))
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.pytho
I spoke about iterating through a bunch of lists in my last post, but in
fact I'm iterating through a bunch of dicts in the example I gave. Sorry.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.o
On 03/01/2014 06:55, Keith Winston wrote:
Mark wrote: You enjoy making life difficult for yourself :) You've
assigned strings to the name func, just assign the functions themselves?
Like.
for func in max, min:
print(func.__name__, func(range(5)))
Output.
max 4
min
Mark wrote: You enjoy making life difficult for yourself :) You've
assigned strings to the name func, just assign the functions themselves?
Like.
>
> for func in max, min:
> print(func.__name__, func(range(5)))
>
> Output.
>
> max 4
> min 0
>
>
I wouldn't say I enjoy making life difficult fo
On 03/01/2014 06:18, Keith Winston wrote:
Shoot: I sent this response directly to Mark, without even trimming.
Here it is to the list...
Hi Mark: sorry for unclarity. I am probably going to make a hash of
explaining this, but here goes:
I want to iterate a variable across a list of objects, and
Shoot: I sent this response directly to Mark, without even trimming. Here
it is to the list...
Hi Mark: sorry for unclarity. I am probably going to make a hash of
explaining this, but here goes:
I want to iterate a variable across a list of objects, and print both the
outputs (wrong word) of sai