Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78854
| Date | 2014-10-08 14:49 -0700 |
|---|---|
| From | Ethan Furman <ethan@stoneleaf.us> |
| Subject | Re: operator module functions |
| References | (3 earlier) <m1426b$kgq$1@ger.gmane.org> <543592AE.80807@stoneleaf.us> <1412797764.3704154.176743089.32D63D13@webmail.messagingengine.com> <54359623.8060307@stoneleaf.us> <1412803417.3733140.176776081.0B98584A@webmail.messagingengine.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14691.1412804943.18130.python-list@python.org> (permalink) |
[redirecting back to the list] On 10/08/2014 02:23 PM, random832@fastmail.us wrote: > On Wed, Oct 8, 2014, at 15:53, Ethan Furman wrote: >> On 10/08/2014 12:49 PM, random832@fastmail.us wrote: >>> On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote: >>>> >>>> LOL, no kidding! The main reason I bother using the operator module is >>>> for the readability of not seeing the dunders, >>>> and the writability of not having to type them. >>> >>> I'm not sure what situation you would have to type them (as opposed to >>> simply a + b) that the operator module would help with. >> >> unittest springs to mind: >> >> self.assertRaises(TypeError, op.add, obj1, obj2) > > Er, my point is, that is not a situation where you would be able to use > obj1.__add__ - you'd have to use the operator module *anyway*, and > therefore aren't using it just to get the convenience of a non-dunder > name. self.assertRaises(TypeError, lambda x, y: x+y, obj1, obj2) -- ~Ethan~
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
operator module functions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-08 12:41 +1100
Re: operator module functions Terry Reedy <tjreedy@udel.edu> - 2014-10-08 02:28 -0400
Re: operator module functions marco.nawijn@colosso.nl - 2014-10-08 01:46 -0700
Re: operator module functions Chris Angelico <rosuav@gmail.com> - 2014-10-08 20:32 +1100
Re: operator module functions Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-10-09 10:37 +1300
Re: operator module functions Chris Angelico <rosuav@gmail.com> - 2014-10-09 09:30 +1100
Re: operator module functions Chris Kaynor <ckaynor@zindagigames.com> - 2014-10-08 15:40 -0700
Re: operator module functions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-08 21:57 +1100
Re: operator module functions Terry Reedy <tjreedy@udel.edu> - 2014-10-08 15:09 -0400
Re: operator module functions Ethan Furman <ethan@stoneleaf.us> - 2014-10-08 12:38 -0700
Re: operator module functions random832@fastmail.us - 2014-10-08 15:49 -0400
Re: operator module functions Gelonida N <gelonida@gmail.com> - 2014-10-08 23:05 +0200
Re: operator module functions Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-08 15:23 -0600
Re: operator module functions Ethan Furman <ethan@stoneleaf.us> - 2014-10-08 14:49 -0700
Re: operator module functions Chris Kaynor <ckaynor@zindagigames.com> - 2014-10-08 14:21 -0700
Re: operator module functions Ben Finney <ben+python@benfinney.id.au> - 2014-10-09 08:57 +1100
Re: operator module functions Terry Reedy <tjreedy@udel.edu> - 2014-10-08 18:46 -0400
Re: operator module functions Ethan Furman <ethan@stoneleaf.us> - 2014-10-08 16:35 -0700
Re: operator module functions Ned Batchelder <ned@nedbatchelder.com> - 2014-10-08 21:41 -0400
csiph-web