durusmail: quixote-users: Quixote changing object type, from list to _QuoteWrapper
Quixote changing object type, from list to _QuoteWrapper
2003-01-27
2003-01-27
2003-01-27
2003-01-27
2003-01-27
2003-01-27
2003-01-27
Quixote changing object type, from list to _QuoteWrapper
Nicola Larosa
2003-01-27
Thanks for the quick answer, Andrew.


 > Convert it back to a string by writing
 > 'str(interface["services"])[0]'.

Well, it's not a string, it's a list of dicts. It would return '[', not
exactly what I need. :^)


 > Or put this in a helper function that's a regular Python function.

It's not clear how I should go about it. The PTL does this:

interfaces = self._getInterfaces()
for interface in interfaces:
      service = interface["services"][0]
      ...other stuff...

where self._getInterfaces is a regular function. Should I pass the current
"interface" instance and an index to a function, and get
interface["services"][idx] in return? Looks a bit clumsy.

And why does interface["services"] become (part of) an htmltext object? It's
a list, not a string, after all. The other fields in the "interface" dict
are left well alone, only "bgColor" is converted to htmltext, and rightly
so, since it's computed dinamically.

This smells trouble. :^)


--
"Python is the Beatles of programming languages."
    Aaron K. Johnson on comp.lang.python

Nicola Larosa - nico@tekNico.net



reply