Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75774
| References | <mailman.12674.1407271813.18130.python-list@python.org> <53e17b95$0$29981$c3e8da3$5496439d@news.astraweb.com> |
|---|---|
| Date | 2014-08-06 12:07 +1000 |
| Subject | Re: Making every no-arg method a property? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12684.1407291183.18130.python-list@python.org> (permalink) |
On Wed, Aug 6, 2014 at 10:49 AM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > A > plethora of argument-less methods is a code smell -- that doesn't mean it's > *necessarily* a bad idea, but the class design really needs a careful > review. There are plenty of no-argument mutator methods, where the name of the method (and the target object, obviously) is all the info you need. You can clear() or copy() something with any more info, reverse() a list, pop() from a list, etc. (Okay, the last one has a default argument, but that raises an even worse point: adding a defaulted argument to a no-argument method suddenly stops it from being a property, which violates the usual rule that you can add a defaulted argument to anything without breaking anything.) ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Making every no-arg method a property? Christian Calderon <calderon.christian760@gmail.com> - 2014-08-05 12:39 -0700
Re: Making every no-arg method a property? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-08-05 13:57 -0700
Re: Making every no-arg method a property? Grant Edwards <invalid@invalid.invalid> - 2014-08-05 21:14 +0000
Re: Making every no-arg method a property? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-08-06 10:34 +1200
Re: Making every no-arg method a property? Grant Edwards <invalid@invalid.invalid> - 2014-08-06 05:13 +0000
Re: Making every no-arg method a property? Rob Gaddi <rgaddi@technologyhighland.invalid> - 2014-08-06 09:53 -0700
Re: Making every no-arg method a property? alister <alister.nospam.ware@ntlworld.com> - 2014-08-06 10:09 +0000
Re: Making every no-arg method a property? Terry Reedy <tjreedy@udel.edu> - 2014-08-06 15:04 -0400
Re: Making every no-arg method a property? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-06 10:49 +1000
Re: Making every no-arg method a property? Chris Angelico <rosuav@gmail.com> - 2014-08-06 12:07 +1000
Re: Making every no-arg method a property? Steven D'Aprano <steve@pearwood.info> - 2014-08-06 09:15 +0000
Re: Making every no-arg method a property? Chris Angelico <rosuav@gmail.com> - 2014-08-06 21:26 +1000
Re: Making every no-arg method a property? alister <alister.nospam.ware@ntlworld.com> - 2014-08-06 10:12 +0000
csiph-web