On Tue, Jul 8, 2008 at 9:14 AM, Don Jennings <[EMAIL PROTECTED]> wrote:
> Hi, folks.
>
> From within a class, I want to return a string with data from non-empty
> variables in a class.
>
> I could create a list of all the variables and then iterate over them,
> dropping the ones which are empty, then join() and return them; however, I
> am guessing there is another way to get that list of variables or to
> accomplish my goal. Suggestions?

It would help to see code that works according to your suggestion.

Where do the variables come from? Do you mean a list of all the
attributes in an instance of a class? A list comprehension is often
useful for creating a filtered list but I don't know if it will work
for you without understanding better what you want to do.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to