473,549 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why it says str not callable?

20 New Member
Expand|Select|Wrap|Line Numbers
  1. >>> li=[4,5]
  2. >>> map(str,li)
  3.  
  4. Traceback (most recent call last):
  5.   File "<pyshell#1>", line 1, in <module>
  6.     map(str,li)
  7. TypeError: 'str' object is not callable
May 31 '14 #1
1 1720
bvdet
2,851 Recognized Expert Moderator Specialist
You have used 'str' as an identifier which masks the built in type. Delete the identifier.
Expand|Select|Wrap|Line Numbers
  1. del str
May 31 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

21
3806
by: Roy Smith | last post by:
I've got a function which gets passed a call-back function as a parameter. I want to check to make sure the thing passed in is indeed callable. Is: assert '__call__' in dir (param) the right thing to do, or is there something cleaner? Will that work for all callable values of param, regardless if it's a static function, class method,...
7
2420
by: Duncan Smith | last post by:
I recently started to rewrite a class and decided to take a bunch of related methods and put them in a separate callable class. (They're all what I would call pointwise operations on pairs of instances, they raise exceptions for identical reasons, and they all return a new instance). It seemed like a good idea at the time, but now I'm not so...
4
5916
by: Michal Vitecek | last post by:
hello everyone, today i've come upon a strange exception, consider the following file test.py: --- beginning of test.py --- class A(object): def method1(parA): print "in A.method1()"
2
1500
by: Mirko Zeibig | last post by:
Hello everybody, I recently stumbled across the proposal of removing `callable` in Python 3000 (http://python.org/peps/pep-3000.html) catching an exception instead, maybe something like this: --- snip --- $ python2.3 Python 2.3.3 (#1, Apr 6 2004, 01:47:39) on linux2 Type "help", "copyright", "credits" or "license" for more information.
1
11149
by: homepricemaps | last post by:
if i do the following i get the url of an image i am looking for image = "" image = bs.img print image however if i do this out.write (image ) i get an error that says "nonetype error is not callable"
10
6984
by: Nicolas Fleury | last post by:
Hi everyone, I was wondering if it would make sense to make staticmethod objects callable, so that the following code would work: class A: @staticmethod def foo(): pass bar = foo() I understand staticmethod objects don't need to implement __call__ for
7
1608
by: Antoon Pardon | last post by:
I have been reading http://www.python.org/dev/peps/pep-3100/ en there is written: To be removed: ... callable(): just call the object and catch the exception ...
6
2398
by: Ron Garret | last post by:
If I do this: def f(self): print self class c1: pass setattr(c1, 'm1', f) Then f is automagically transmogrified into the appropriate sort of method depending on how it is used:
3
1576
by: Ge Chunyuan | last post by:
hi Group: Once use ActivePython latest version for Python 2.5.1. I happened to find function "str" is not callable, but it is available for Python 2.5. Can anybody give some comments about it? Any response is highly appreciated.
6
1500
by: netimen | last post by:
Can I substitute a method of a class by a callable object (not a function)? I can very easy insert my function in a class as a method, but an object - can't. I have the following: class Foo(object): pass class Obj(object):
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7473
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7810
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.