Is count supposed to still work?

Tim Peters tim.one at comcast.net
Fri Jul 12 16:56:19 EDT 2002


[David LeBlanc]
> Whether or not you explicitly import string,
> 	count(mystring, substring)
> isn't working ("NameError: global name 'count' is not defined") (N.B. this
> statement is in a method of a class),

Python has never had a builtin function named "count", so I don't see how it
ever could have worked.  The string module did and still does export a
function named count, but you have to import it first if you want to use it
as a function.






More information about the Python-list mailing list