Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49625
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-07-02 00:33 -0700 |
| References | <mailman.4021.1372572404.3114.python-list@python.org> |
| Message-ID | <bc53942a-fb26-4ac9-a6a8-8cac2b35b2d4@googlegroups.com> (permalink) |
| Subject | Re: Stupid ways to spell simple code |
| From | Russel Walker <russ.pobox@gmail.com> |
On Sunday, June 30, 2013 8:06:35 AM UTC+2, Chris Angelico wrote:
> There's a bit of a discussion on python-ideas that includes a function
>
> that raises StopIteration. It inspired me to do something stupid, just
>
> to see how easily I could do it...
>
>
>
> On Sun, Jun 30, 2013 at 3:45 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
>
> Re: [Python-ideas] "Iteration stopping" syntax
>
> >>>> def stop():
>
> > ... raise StopIteration
>
>
>
> Here's a much more insane way to spell that:
>
>
>
> stop = (lambda: 0 and (yield 1))().__next__
>
>
>
> So, here's a challenge: Come up with something really simple, and
>
> write an insanely complicated - yet perfectly valid - way to achieve
>
> the same thing. Bonus points for horribly abusing Python's clean
>
> syntax in the process.
>
>
>
> Go on, do your worst!
>
>
>
> ChrisA
Here's a way to count items in a string.
def count(string, x):
return len(''.join(string)) - len(''.join(string).replace(x, '')) / len(x)
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Stupid ways to spell simple code Chris Angelico <rosuav@gmail.com> - 2013-06-30 16:06 +1000
Re: Stupid ways to spell simple code Rick Johnson <rantingrickjohnson@gmail.com> - 2013-06-30 07:58 -0700
Re: Stupid ways to spell simple code Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-30 16:08 +0100
Re: Stupid ways to spell simple code Chris Angelico <rosuav@gmail.com> - 2013-07-01 01:20 +1000
Re: Stupid ways to spell simple code Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-30 11:26 -0600
Re: Stupid ways to spell simple code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-30 17:36 +0000
Re: Stupid ways to spell simple code Roy Smith <roy@panix.com> - 2013-06-30 13:44 -0400
Re: Stupid ways to spell simple code Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-30 22:52 +0100
Re: Stupid ways to spell simple code Neil Cerutti <neilc@norwich.edu> - 2013-07-01 12:59 +0000
Re: Stupid ways to spell simple code Chris Angelico <rosuav@gmail.com> - 2013-07-01 23:14 +1000
Re: Stupid ways to spell simple code Joshua Landau <joshua.landau.ws@gmail.com> - 2013-07-01 17:30 +0100
Re: Stupid ways to spell simple code Marcin Szamotulski <mszamot@gmail.com> - 2013-07-01 20:36 +0100
Re: Stupid ways to spell simple code Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-01 22:09 +0000
Re: Stupid ways to spell simple code 88888 Dihedral <dihedral88888@gmail.com> - 2013-07-01 21:16 -0700
Re: Stupid ways to spell simple code Marcin Szamotulski <mszamot@gmail.com> - 2013-07-02 07:22 +0100
Re: Stupid ways to spell simple code Chris Angelico <rosuav@gmail.com> - 2013-07-02 02:32 +1000
Re: Stupid ways to spell simple code Russel Walker <russ.pobox@gmail.com> - 2013-07-02 00:33 -0700
csiph-web