Beginner question: Converting Single-Element tuples to list

Steven Bethard steven.bethard at gmail.com
Mon Jun 27 23:42:51 EDT 2005


vdavidster at gmail.com wrote:
>     if type(input) == str:

You might consider writing this as:

     if isinstance(input, basestring):

I don't know if pyparsing ever produces unicode objects, but in case it 
does (or it starts to in the future), isinstance is a better call here.

STeVe



More information about the Python-list mailing list