Steve Holden wrote:

I've been wondering whether it's possible to perform a similar analysis on non-mapping-type format strings, so as to know how long a tuple to provide,

I just tried an experiment, and it doesn't seem to be possible.

The problem seems to be that it expects the arguments to be
in the form of a tuple, and if you give it something else,
it wraps it up in a 1-element tuple and uses that instead.

This seems to happen even with a custom subclass of tuple,
so it must be doing an exact type check.

So it looks like you'll have to parse the format string.

--
Greg Ewing, Computer Science Dept,
University of Canterbury,       
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to