Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #88121
| References | <87bnjhyohp.fsf@uriel.graune.org> <mailman.156.1427310804.10327.python-list@python.org> <9b6f41d0-e27e-4e0b-b04d-d15627667330@googlegroups.com> <mailman.183.1427349642.10327.python-list@python.org> <b806441f-ea43-48a7-97a2-223cbfd6b8ff@googlegroups.com> |
|---|---|
| Date | 2015-03-27 12:56 +1100 |
| Subject | Re: Supply condition in function call |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.230.1427421404.10327.python-list@python.org> (permalink) |
On Fri, Mar 27, 2015 at 12:41 PM, Rustom Mody <rustompmody@gmail.com> wrote: > On Thursday, March 26, 2015 at 11:30:57 AM UTC+5:30, Chris Angelico wrote: >> On Thu, Mar 26, 2015 at 3:02 PM, Rustom Mody wrote: >> > [And BTW >> > help(filter) in python2 is much better documention than in python3 >> > ] >> >> Python 2.7.3 (default, Mar 13 2014, 11:03:55) >> [GCC 4.7.2] on linux2 >> >> filter(...) >> filter(function or None, sequence) -> list, tuple, or string >> >> Return those items of sequence for which function(item) is true. If >> function is None, return the items that are true. If sequence is a tuple >> or string, return the same type, else return a list. >> >> Python 3.5.0a0 (default:4709290253e3, Jan 20 2015, 21:48:07) >> [GCC 4.7.2] on linux >> >> class filter(object) >> | filter(function or None, iterable) --> filter object >> | >> | Return an iterator yielding those items of iterable for which function(item) >> | is true. If function is None, return the items that are true. >> | >> | Methods defined here: >> (chomp a handful of method details) > > Sackful may be more accurate :-) Not really. Here's the entire help(filter) text: Help on class filter in module builtins: class filter(object) | filter(function or None, iterable) --> filter object | | Return an iterator yielding those items of iterable for which function(item) | is true. If function is None, return the items that are true. | | Methods defined here: | | __getattribute__(self, name, /) | Return getattr(self, name). | | __iter__(self, /) | Implement iter(self). | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | __next__(self, /) | Implement next(self). | | __reduce__(...) | Return state information for pickling. > On a different note... I wonder how you do it: > Look at 300 lines of code and notice exactly those 3 that... um... cause > a lot of trouble :-) > [My eyes just glaze over] That's called experience. It's an intrinsic part of being a programmer. > On a more specific note, its the 1st line: > > class filter(object) > > which knocks me off. > If a more restricted type from the ABC was shown which exactly captures all > the iterator-specific stuff like __iter__, __next__ it would sure help (me) But there's no point in subclassing for everything. In this case, filter doesn't subclass anything but object, so there's no value in stating anything else. You want to know if it's iterable? Check for an __iter__ method. Etcetera. > On a 3rd note: I think Ive found a little buglet while trying to post this message, can you confirm? > [Linux Debian Xfce] > > After selecting the line above [inside python inside help(filter) ]for > cut-pasting here, by mistake I pressed Ctrl-C rather than Ctrl-Shift-C > An exception was thrown and the terminal remained in some sort of raw mode > even after exiting python Yes, confirmed. It'll be something to do with what happens when you have 'less' and readline working together, probably. Tip: Use Ctrl-Insert rather than Ctrl-Shift-C. It's the more standard keystroke anyway. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Supply condition in function call Manuel Graune <manuel.graune@koeln.de> - 2015-03-25 18:29 +0100
Re: Supply condition in function call Joel Goldstick <joel.goldstick@gmail.com> - 2015-03-25 13:41 -0400
Re: Supply condition in function call Manuel Graune <manuel.graune@koeln.de> - 2015-03-25 18:51 +0100
Re: Supply condition in function call Joel Goldstick <joel.goldstick@gmail.com> - 2015-03-25 14:17 -0400
Re: Supply condition in function call Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 12:22 -0600
Re: Supply condition in function call Joel Goldstick <joel.goldstick@gmail.com> - 2015-03-25 14:42 -0400
Re: Supply condition in function call Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 11:44 -0600
Re: Supply condition in function call Grant Edwards <invalid@invalid.invalid> - 2015-03-25 19:53 +0000
Re: Supply condition in function call Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-25 14:49 -0600
Re: Supply condition in function call Grant Edwards <invalid@invalid.invalid> - 2015-03-26 15:41 +0000
Re: Supply condition in function call Terry Reedy <tjreedy@udel.edu> - 2015-03-25 14:50 -0400
Re: Supply condition in function call Gary Herron <gherron@digipen.edu> - 2015-03-25 12:13 -0700
Re: Supply condition in function call Rustom Mody <rustompmody@gmail.com> - 2015-03-25 21:02 -0700
Re: Supply condition in function call Chris Angelico <rosuav@gmail.com> - 2015-03-26 17:00 +1100
Re: Supply condition in function call Rustom Mody <rustompmody@gmail.com> - 2015-03-26 18:41 -0700
Re: Supply condition in function call Chris Angelico <rosuav@gmail.com> - 2015-03-27 12:56 +1100
Re: Supply condition in function call Rustom Mody <rustompmody@gmail.com> - 2015-03-26 19:21 -0700
Re: Supply condition in function call Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-27 15:34 +1100
Re: Supply condition in function call Rustom Mody <rustompmody@gmail.com> - 2015-03-27 06:48 -0700
Re: Supply condition in function call Chris Angelico <rosuav@gmail.com> - 2015-03-28 01:17 +1100
Re: Supply condition in function call Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-03-27 16:00 +0000
Re: Supply condition in function call Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-28 18:32 +1100
Re: Supply condition in function call Chris Angelico <rosuav@gmail.com> - 2015-03-28 18:45 +1100
Re: Supply condition in function call Larry Hudson <orgnut@yahoo.com> - 2015-03-27 17:26 -0700
Re: Supply condition in function call Rustom Mody <rustompmody@gmail.com> - 2015-03-27 18:27 -0700
Re: Supply condition in function call Marko Rauhamaa <marko@pacujo.net> - 2015-03-28 09:50 +0200
Re: Supply condition in function call Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-28 20:17 +1100
Re: Supply condition in function call Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-28 03:19 -0600
Re: Supply condition in function call Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-03-28 20:57 +1100
Re: Supply condition in function call Cameron Simpson <cs@zip.com.au> - 2015-03-30 09:35 +1100
Re: Supply condition in function call Manuel Graune <manuel.graune@koeln.de> - 2015-03-30 00:46 +0200
Re: Supply condition in function call Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-26 20:25 -0600
Re: Supply condition in function call Rustom Mody <rustompmody@gmail.com> - 2015-03-26 19:46 -0700
Re: Supply condition in function call Manuel Graune <manuel.graune@koeln.de> - 2015-03-26 07:27 +0100
Re: Supply condition in function call Cameron Simpson <cs@zip.com.au> - 2015-03-26 18:06 +1100
Re: Supply condition in function call Manuel Graune <manuel.graune@koeln.de> - 2015-03-27 21:02 +0100
Re: Supply condition in function call Cameron Simpson <cs@zip.com.au> - 2015-03-28 09:55 +1100
Re: Supply condition in function call Peter Otten <__peter__@web.de> - 2015-03-26 10:03 +0100
Re: Supply condition in function call Manuel Graune <manuel.graune@koeln.de> - 2015-03-27 20:46 +0100
Re: Supply condition in function call Peter Otten <__peter__@web.de> - 2015-03-27 21:38 +0100
Re: Supply condition in function call smap <askme.first@thankyouverymuch.invalid> - 2015-03-28 08:58 +0000
csiph-web