Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone04.am1.xlned.com!bcyclone04.am1.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.050 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'python3': 0.07; 'sys': 0.07; 'python': 0.11; "'__doc__',": 0.16; 'sys.modules': 0.16; 'advance.': 0.19; '>>>': 0.22; 'import': 0.22; '>>>': 0.24; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; '"",': 0.31; 'subject:what': 0.31; 'file': 0.32; '(most': 0.33; 'subject:with': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'hi,': 0.36; 'wrong': 0.37; 'skip:& 10': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'recent': 0.39; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'more': 0.64; 'cygwin': 0.84; '2013,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=DuZy7es1vWcLXSVIwnwpOCyHImmgGSTT28bH3owl/xQ=; b=nH3W2fbp0ETB9qbDxLtd1MvUU0l+Cwp3C2tYwRZd8PKv2KDXENN1HP3lTVyXAQIK3F D6AM7rvQW7gaHKpYMrpMWF13hcWTHXQ1FoSKZwiq8NXSPo3Khag6maOkC576o8ucru7d bWfaJ/7yD/LLxWx0fBcD3nSXWIYshm33isscTaNLGk6YefvtwN49WHkScd0vOwO4tKgC fgQFqYNESNmhAZfumG4bUxmVSko2e4g33FG8ED/vHqMfAmwbnvqmzo3iomTLjFbOLQux YQOgfaIKKI5agIlwaz1T8vcYFh1IhM/n9U9TrhQbRynaUY5cNBFPS8Fgge7RpbNqwUJs TU3g== MIME-Version: 1.0 X-Received: by 10.43.154.138 with SMTP id le10mr12985172icc.50.1419146914066; Sat, 20 Dec 2014 23:28:34 -0800 (PST) Date: Sun, 21 Dec 2014 12:58:34 +0530 Subject: what is wrong with d.clear()? From: shawool To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c2d3dab27ac7050ab4e388 X-Mailman-Approved-At: Mon, 22 Dec 2014 09:16:04 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 78 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1419236165 news.xs4all.nl 2891 [2001:888:2000:d::a6]:41362 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 6482 X-Received-Body-CRC: 3378519301 Xref: csiph.com comp.lang.python:82759 --001a11c2d3dab27ac7050ab4e388 Content-Type: text/plain; charset=UTF-8 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) >>> 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 "", line 1, in >>> d Traceback (most recent call last): File "", line 1, in >>> quit() Traceback (most recent call last): File "", line 1, in Thanks in advance. Best regards, Shawool --001a11c2d3dab27ac7050ab4e388 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

where am i going wrong ?

$ python3
Python 3.2.= 5 (default, Oct=C2=A0 2 2013, 22:58:11)
[GCC 4.8.1] on cygwin
Type &q= uot;help", "copyright", "credits" or "license= " for more information.
>>> d =3D {}
>>> impor= t sys
>>> d =3D sys.modules
>>> type(d)
<clas= s 'dict'>
>>> dir(d)
['__class__', '_= _contains__', '__delattr__', '__delitem__', '__doc_= _', '__eq__', '__format__', '__ge__', '__ge= tattribute__', '__getitem__', '__gt__', '__hash__&#= 39;, '__init__', '__iter__', '__le__', '__len__= ', '__lt__', '__ne__', '__new__', '__reduce= __', '__reduce_ex__', '__repr__', '__setattr__'= , '__setitem__', '__sizeof__', '__str__', '__su= bclasshook__', 'clear', 'copy', 'fromkeys', = 9;get', 'items', 'keys', 'pop', 'popitem= 9;, 'setdefault', 'update', 'values']
>>&g= t; d.clear()
Traceback (most recent call last):
=C2=A0 File "<= ;stdin>", line 1, in <module>
>>> d
Traceback = (most recent call last):
=C2=A0 File "<stdin>", line 1, = in <module>
>>> quit()
Traceback (most recent call las= t):
=C2=A0 File "<stdin>", line 1, in <module>


Thanks in advance.

Best regards,
Shaw= ool
--001a11c2d3dab27ac7050ab4e388--