Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8973
| References | <5a4867f1-929c-4cde-b47e-4b11de767f39@h38g2000pro.googlegroups.com> |
|---|---|
| Date | 2011-07-06 15:15 -0400 |
| Subject | Re: Does hashlib support a file mode? |
| From | geremy condra <debatem1@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.716.1309979758.1164.python-list@python.org> (permalink) |
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 | Next — Previous in thread | Next in thread | Find similar | Unroll 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