A function that I wrote works on a list or on a string. If the
function is passed a string, then it wraps the string in a list at the
top of the function. Is it bad form to wrap the sting in place?

if not isinstance(someVar, list):
    someVar = [someVar]

To avoid that, I am creating a list then appending the original value:

if not isinstance(someVar, list):
    temp = someVar
    someVar = []
    someVar.append(temp)

Is my prudence unwarrented?

Thanks!


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to