> It's probably worth looking into, though. Why does IPython evaluate > 'str' in the user's namespace? Assigning to 'str' in the user's > namespace certainly doesn't affect the __builtins__ (if it did, that's > definitely a bug!) Yes, that is true. I guess it really depends on how IPython is calling str and that is worth looking at. Brian > -- > Robert Kern > > "I have come to believe that the whole world is an enigma, a harmless > enigma that is made terrible by our own mad attempt to interpret it as > though it had an underlying truth." >  -- Umberto Eco > > -- > error message "str object not callable" when not calling string > https://bugs.launchpad.net/bugs/355837 > You received this bug notification because you are a member of IPython > Developers, which is subscribed to IPython. > > Status in IPython - Enhanced Interactive Python: New > > Bug description: > There have been a few times where, when writing a for-loop, I will get a "'str' object is not callable" when I expect just to hit RET and begin writing the rest of the loop. The problem fixes itself when I log out and back ino ipython. I thought it might be related to defining a python name like "dict" in the example below, but I don't think so. Below is a transcript of the last occurrence. > > I am using ipython 0.8.4 on an IBM Thinkpad x31 running Ubuntu Ibex. > > > In [31]: dict = {'a':'b','c':'d'} > > In [32]: str = 'wqe' > > In [33]: for i,j in dict: > > > > > > KeyboardInterrupt > > In [33]: dict > Out[34]: {'a': 'b', 'c': 'd'} > > In [35]: i > --------------------------------------------------------------------------- > NameError                                 Traceback (most recent call last) > > /home/shaunalynn/ in () > > NameError: name 'i' is not defined > > In [36]: j > --------------------------------------------------------------------------- > NameError                                 Traceback (most recent call last) > > /home/shaunalynn/ in () > > NameError: name 'j' is not defined > > In [37]: for i, j in dict: > > > > KeyboardInterrupt > > In [37]: dictionary = {'a':'b','c','d'} > ------------------------------------------------------------ >   File "", line 1 >     dictionary = {'a':'b','c','d'} >                              ^ > SyntaxError: invalid syntax > > > In [39]: dictionary = {'a':'b','c'"'d'} > ------------------------------------------------------------ >   File "", line 1 >     dictionary = {'a':'b','c'"'d'} >                                  ^ > SyntaxError: EOL while scanning single-quoted string > > > In [40]: dictionary = {'a':'b','c':'d'} > > In [41]: for i, j in dictionary: > > > > > > > > KeyboardInterrupt > > In [41]: > > In [42]: exit() > Do you really want to exit ([y]/n)? > shaunalynn@duffles:~$ ipython > Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49) > Type "copyright", "credits" or "license" for more information. > > IPython 0.8.4 -- An enhanced Interactive Python. > ?         -> Introduction and overview of IPython's features. > %quickref -> Quick reference. > help      -> Python's own help system. > object?   -> Details about 'object'. ?object also works, ?? prints more. > > In [1]: dict = {'a':'b','c':'d'} > > In [2]: for i, j in dict: >   ...:     print i,j > -- Brian E. Granger, Ph.D. Assistant Professor of Physics Cal Poly State University, San Luis Obispo