Le Thu, 11 Jun 2009 12:56:27 +0200, The Green Tea Leaf <thegreenteal...@gmail.com> s'exprima ainsi:
> My advice: "Learning Python" very nice book > > def show(*args): > print args > > def show2(*args): > for item in args: > print "Blabla:",item > > show(1,2,"hello") > show2(1,2,"hello") Well, it's not what the poster asked for: where are the (var) names? Denis > On Thu, Jun 11, 2009 at 03:43, Robert Lummis<robert.lum...@gmail.com> wrote: > > I want to write a function that I can use for debugging purposes that > > prints the values of whatever list of object references it is given as > > arguments, without knowing in advance how many object references it > > will be called with or what they might be. For example, the call: > > show(a,b,c) would output the values of the arguments like this: > > > > a = 3 > > b = 'john' > > c = 'Monday' > > > > while show (x) would output (for example): > > > > x = 3.14 > > > > of course displaying whatever the actual current values are. For a > > collection object it would make sense to output just the first few > > values. > > > > So within the 'show' function definition I have to somehow get a list > > of the literal argument names it was called with and then use the > > names as globals to get the values. How do I do that? > > > > If this can't be done but there is a completely different way to > > achieve a similar result, what is it? > > > > I'm trying to learn python but it's a struggle because the > > documentation is so dispersed. If there is a solution to this > > question, what documentation could I have looked at to find it on my > > own? > > > > BTW I'm using python 3.01 if it matters. > > > > -- > > Robert Lummis > > _______________________________________________ > > Tutor maillist - tu...@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > > > ------ la vita e estrany _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor