Re: Type Problem
Victor wrote...
len = len(dirs)
The function 'len' is a built-in function in Python. If you assign an
integer to the name 'len', that will replace the function with an int. And
you can't call an int.
My suggestion: Do not use 'len' as a variable name. Use something else, like:
directorycount=len(dirs)
Greetings,
type(len)
<type 'builtin_function_or_method'>
print len("Victor")
6
len=42
type(len)
<type 'int'>
len("Victor")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
len("Victor")
TypeError: 'int' object is not callable
--
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html
.
Relevant Pages
- Re: Non Continuous Subsequences
... v1) original eager Python+Psyco version ... v6) lazy D version with my libs ... lazy Python version, no allocations ... int n = len; ... (comp.lang.python) - Re: Why is java considered a language for "web" or "internet" programming?
... I don't remember reading exact things about Perl interpreter, ... load and parse bytecodes. ... I think, integer in Perl or Python or other scripting languages is some structure, with at the least field for type and value, and pointer to this structure you hold in 'i' variable. ... const int NNUM = 1000000; ... (comp.lang.java.help) - Re: Official definition of call-by-value (Re: Finding the instance reference...)
... Yes, which is why we have int, str, and list classes which, unlike some ... Since pickle can't predict what aspects of the ... you can't do so in Python. ... with a foo attribute. ... (comp.lang.python) - Re: [BUG] IMO, but no opinions? Uncle Tim? was: int(float(sys.maxint)) buglet ?
... > Ok, I understand the expediency of that policy, but what is now the meaning ... > transparent unification of int and long to a single integer type? ... Python isn't C, and the ... "shouldn't" bother anyone. ... (comp.lang.python) - Re: True inconsistency in Python
... Maybe you should summarize your central tenets, ... gotten lost. ... Python has as a central concept that everyone's an adult. ... They're builtins, just like all the other builtins like int, max, file, ... (comp.lang.python) |
|