Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76185
| References | <201408131006549222-not@myrealaddresscom> <2014081311203037705-not@myrealaddresscom> |
|---|---|
| Date | 2014-08-13 20:29 +1000 |
| Subject | Re: odd difference calling function from class or instance variable |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12919.1407925761.18130.python-list@python.org> (permalink) |
On Wed, Aug 13, 2014 at 8:20 PM, GregS <not@my.real.address.com> wrote: > Thanks to both of you for your incredibly prompt replies. My homework for > tonight is to digest the descriptor protocol... > > Peter, thanks for suggesting using staticmethod() to get the behaviour I was > expecting. I've only used staticmethod as a decorator before now. > > Chris, I agree that it's not every day you assign functions to class > attributes, but it does have its uses (I won't bore you with mine). Now > that I know how it treads on the toes of Python's method magic, I can decide > whether it's the best approach or not. You seem to know what you're doing, which is a good start :) I aimed my explanation a bit lower than your actual knowledge turns out to be, so go ahead and do what you know you need to do. You're not treading on Python's toes, here, but you're basically recreating some of what Python normally does under the covers, so you'll need to actually understand (instead of just treating as black-box magic) stuff like the descriptor protocol. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
odd difference calling function from class or instance variable GregS <not@my.real.address.com> - 2014-08-13 10:06 +0100
Re: odd difference calling function from class or instance variable Peter Otten <__peter__@web.de> - 2014-08-13 11:40 +0200
Re: odd difference calling function from class or instance variable Chris Angelico <rosuav@gmail.com> - 2014-08-13 19:45 +1000
Re: odd difference calling function from class or instance variable GregS <not@my.real.address.com> - 2014-08-13 11:20 +0100
Re: odd difference calling function from class or instance variable Chris Angelico <rosuav@gmail.com> - 2014-08-13 20:29 +1000
csiph-web