Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8973

Re: Does hashlib support a file mode?

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 <debatem1@gmail.com>
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 <debatem1@gmail.com>
To Phlip <phlip2005@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.716.1309979758.1164.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Wed, Jul 6, 2011 at 3:07 PM, Phlip <phlip2005@gmail.com> wrote:
> On Jul 6, 11:42 am, Andrew Berg <bahamutzero8...@gmail.com> wrote:
>> On 2011.07.06 12:38 PM, Phlip wrote:> Python sucks. m = md5() looks like an initial assignment, not a
>> > special magic storage mode. Principle of least surprise fail, and
>> > principle of most helpful default behavior fail.
>>
>> func() = whatever the function returns
>> func = 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 = 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 = hashlib.md5()
>>> m2 = hashlib.md5()
>>> id(m1)
139724897544712
>>> id(m2)
139724897544880

Geremy Condra

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Does hashlib support a file mode? Phlip <phlip2005@gmail.com> - 2011-07-06 12:07 -0700
  Re: Does hashlib support a file mode? geremy condra <debatem1@gmail.com> - 2011-07-06 15:15 -0400
  Re: Does hashlib support a file mode? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-06 14:42 -0500
  Re: Does hashlib support a file mode? Mel <mwilson@the-wire.com> - 2011-07-06 15:43 -0400
    Re: Does hashlib support a file mode? Anssi Saari <as@sci.fi> - 2011-07-07 14:29 +0300
      Re: Does hashlib support a file mode? Paul Rudin <paul.nospam@rudin.co.uk> - 2011-07-07 13:13 +0100
  Re: Does hashlib support a file mode? Ian Kelly <ian.g.kelly@gmail.com> - 2011-07-06 13:48 -0600
  Re: Does hashlib support a file mode? Ethan Furman <ethan@stoneleaf.us> - 2011-07-06 13:24 -0700

csiph-web