Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'subject:Does': 0.04; 'python': 0.08; 'defined,': 0.09; 'defined.': 0.09; 'func': 0.09; 'namespace': 0.09; 'wed,': 0.12; 'subject:file': 0.13; 'wrote:': 0.15; 'fail,': 0.16; 'hashlib': 0.16; 'mode.': 0.16; 'object)': 0.16; 'objects:': 0.16; 'occurs.': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; '>>>': 0.16; 'language': 0.20; 'cc:2**0': 0.21; 'maybe': 0.22; 'cc:no real name:2**0': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'expect': 0.25; 'function': 0.26; '(in': 0.26; 'helpful': 0.26; 'message-id:@mail.gmail.com': 0.28; 'import': 0.29; 'call.': 0.29; 'object': 0.30; 'cc:addr:python.org': 0.30; 'definition': 0.30; 'confused': 0.30; 'objects.': 0.30; 'received:209.85.210.46': 0.30; 'received:mail-pz0-f46.google.com': 0.30; 'subject:support': 0.30; 'looks': 0.30; 'least': 0.31; 'subject:?': 0.31; 'andrew': 0.32; 'does': 0.32; 'typically': 0.33; 'initial': 0.33; 'anything': 0.37; 'another': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'created': 0.38; 'two': 0.38; 'received:209': 0.40; 'where': 0.40; 'skip:1 10': 0.66; 'storage': 0.67; 'special': 0.67; 'subject:mode': 0.84; "everything's": 0.91; 'surprise': 0.96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=0FQMWkC4CSmx8PQslvJG5fFx38HIQLMVtbE2g9K988w=; b=uX55NFt+Nn6cB1MazV5PC8Va7A1uFTmDq7Yr1gdwQ6kV1jxx1zdX8NFCN2iST1/3e7 p8cz3H3XwOMOa+VkYPR0VFpW5SjC9gsBCUUyiVNwQTEfM3RhmhL3u8hc5Vt6ds5u2uwQ bUd4ORwhw4EkDzwk4JUKeFsnBzhOuqImUMBiM= MIME-Version: 1.0 In-Reply-To: <5a4867f1-929c-4cde-b47e-4b11de767f39@h38g2000pro.googlegroups.com> References: <5a4867f1-929c-4cde-b47e-4b11de767f39@h38g2000pro.googlegroups.com> Date: Wed, 6 Jul 2011 15:15:54 -0400 Subject: Re: Does hashlib support a file mode? From: geremy condra To: Phlip Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309979758 news.xs4all.nl 21863 [2001:888:2000:d::a6]:32955 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8973 On Wed, Jul 6, 2011 at 3:07 PM, Phlip wrote: > On Jul 6, 11:42=A0am, Andrew Berg wrote: >> On 2011.07.06 12:38 PM, Phlip wrote:> Python sucks. m =3D md5() looks li= ke an initial assignment, not a >> > special magic storage mode. Principle of least surprise fail, and >> > principle of most helpful default behavior fail. >> >> func() =3D whatever the function returns >> func =3D the function object itself (in Python, everything's an object) >> >> Maybe you have Python confused with another language (I don't know what >> exactly you mean by initial assignment). Typically one does not need >> more than one name for a function/method. When a function/method is >> defined, it gets created as a function object and occupies the namespace >> in which it's defined. > > If I call m =3D md5() twice, I expect two objects. > > I am now aware that Python bends the definition of "call" based on > where the line occurs. Principle of least surprise. Python doesn't do anything to the definition of call. If you call hashlib.md5() twice, you get two objects: >>> import hashlib >>> m1 =3D hashlib.md5() >>> m2 =3D hashlib.md5() >>> id(m1) 139724897544712 >>> id(m2) 139724897544880 Geremy Condra