what is wrong with d.clear()?

shawool shawool at gmail.com
Sun Dec 21 02:28:34 EST 2014


Hi,

where am i going wrong ?

$ python3
Python 3.2.5 (default, Oct  2 2013, 22:58:11)
[GCC 4.8.1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> d = {}
>>> import sys
>>> d = sys.modules
>>> type(d)
<class 'dict'>
>>> dir(d)
['__class__', '__contains__', '__delattr__', '__delitem__', '__doc__',
'__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
'__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__',
'__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__',
'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem',
'setdefault', 'update', 'values']
>>> d.clear()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
>>> d
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
>>> quit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

Thanks in advance.

Best regards,
Shawool
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20141221/2b3de5e2/attachment.html>


More information about the Python-list mailing list