On Fri, 06 Dec 2013 19:20:07 -0800, Dan Stromberg wrote:
> On Fri, Dec 6, 2013 at 6:07 PM, Steven D'Aprano <
> steve+comp.lang.pyt...@pearwood.info> wrote:
>> The beauty of Python is that it is a multi-paradigm language. You can
>> write imperative, procedural, functional, OOP, or pipelining styl
On Tue, Dec 10, 2013 at 12:49 AM, Neil Cerutti wrote:
> names = (p.name for p in db.query_people() if p.total_purchases > 0)
> names = (n.upper() for n in names)
> names = (n for n in names if not n.startswith("Q"))
> for n in names:
># Finally actually do something.
>
> Coincidentally it's a
On 2013-12-07, Dan Stromberg wrote:
> BTW, what's pipelining style? Like bash?
I think, in Python, it might refer to composing your program of
a series of generators.
names = (p.name for p in db.query_people() if p.total_purchases > 0)
names = (n.upper() for n in names)
names = (n for n in name
On 07/12/2013 16:25, Steven D'Aprano wrote:
On Sat, 07 Dec 2013 16:13:09 +, Rotwang wrote:
On 07/12/2013 12:41, Jussi Piitulainen wrote:
[...]
if tracks is None:
tracks = []
Sorry to go off on a tangent, but in my code I often have stuff like
this at the start of functions:
Someone was thinking in ruby there.
On Sat, Dec 7, 2013 at 1:14 AM, Dan Stromberg wrote:
>
> On Fri, Dec 6, 2013 at 4:10 PM, Michael Torrie wrote:
>
>> On 12/06/2013 04:54 PM, Dan Stromberg wrote:
>> > Does anyone else feel like Python is being dragged too far in the
>> direction
>> > of long
On 06/12/2013 23:54, Dan Stromberg wrote:
Does anyone else feel like Python is being dragged too far in the
direction of long, complex, multiline one-liners? Or avoiding temporary
variables with descriptive names? Or using regex's for everything under
the sun?
What happened to using classes?
On 12/7/2013 11:13 AM, Rotwang wrote:
On 07/12/2013 12:41, Jussi Piitulainen wrote:
[...]
if tracks is None:
tracks = []
Sorry to go off on a tangent, but in my code I often have stuff like
this at the start of functions:
tracks = something if tracks is None else tracks
or, in
Rotwang writes:
> On 07/12/2013 12:41, Jussi Piitulainen wrote:
> > [...]
> >
> >if tracks is None:
> > tracks = []
>
> Sorry to go off on a tangent, but in my code I often have stuff like
> this at the start of functions:
>
> tracks = something if tracks is None else tracks
>
>
On Saturday, December 7, 2013 10:26:04 PM UTC+5:30, Michael Torrie wrote:
> On 12/06/2013 08:27 PM, Roy Smith wrote:
> > Steven D'Aprano wrote:
> >> The ternary if is slightly unusual and unfamiliar
> > It's only unusual an unfamiliar if you're not used to using it :-)
> > Coming from a C/C++ b
On 12/07/2013 09:56 AM, Michael Torrie wrote:
>> extracols = sorted(set.union(*(set(t.data.keys()) for t in tracks))) if
>> tracks else []
>
> This is a generator expressions, and ternary ifs are common and often
> needed in generator expressions.
Oops. This is not a generator expression at all!
On 12/06/2013 08:27 PM, Roy Smith wrote:
> In article <52a287cb$0$30003$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> The ternary if is slightly unusual and unfamiliar
>
> It's only unusual an unfamiliar if you're not used to using it :-)
> Coming from a C/C++ background,
On Sat, 07 Dec 2013 16:13:09 +, Rotwang wrote:
> On 07/12/2013 12:41, Jussi Piitulainen wrote:
>> [...]
>>
>>if tracks is None:
>> tracks = []
>
> Sorry to go off on a tangent, but in my code I often have stuff like
> this at the start of functions:
>
> tracks = something if t
On 12/07/2013 09:13 AM, Rotwang wrote:
> On 07/12/2013 12:41, Jussi Piitulainen wrote:
>> [...]
>>
>>if tracks is None:
>> tracks = []
>
> Sorry to go off on a tangent, but in my code I often have stuff like
> this at the start of functions:
>
> tracks = something if tracks is Non
On 07/12/2013 12:41, Jussi Piitulainen wrote:
[...]
if tracks is None:
tracks = []
Sorry to go off on a tangent, but in my code I often have stuff like
this at the start of functions:
tracks = something if tracks is None else tracks
or, in the case where I don't intend for the
Steven D'Aprano writes:
> On Fri, 06 Dec 2013 22:27:00 -0500, Roy Smith wrote:
>
> > Just for fun, I took a look through the Songza code base. 66 kloc of
> > non-whitespace Python. I found 192 ternary expressions. Here's a few
> > of the more bizarre ones (none of which I consider remotely rea
On Fri, 06 Dec 2013 22:27:00 -0500, Roy Smith wrote:
> Just for fun, I took a look through the Songza code base. 66 kloc of
> non-whitespace Python. I found 192 ternary expressions. Here's a few
> of the more bizarre ones (none of which I consider remotely readable):
>
> --
On Sat, Dec 7, 2013 at 2:27 PM, Roy Smith wrote:
> --
> extracols = sorted(set.union(*(set(t.data.keys()) for t in tracks))) if
> tracks else []
> --
> c2s = compids2songs(set(targets.keys()) |
> set.un
In article ,
Dan Stromberg wrote:
> A lot of things people do with regex's, could be done with string methods
> more clearly and concisely.
That is true. The problem is, there are a lot of things for which regex
is the right tool, but people get out of practice using them (or never
learned h
In article <52a287cb$0$30003$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> The ternary if is slightly unusual and unfamiliar
It's only unusual an unfamiliar if you're not used to using it :-)
Coming from a C/C++ background, I always found the lack of a ternary
expression rath
On Fri, Dec 6, 2013 at 6:07 PM, Steven D'Aprano <
steve+comp.lang.pyt...@pearwood.info> wrote:
> On Fri, 06 Dec 2013 15:54:22 -0800, Dan Stromberg wrote:
>
> > Does anyone else feel like Python is being dragged too far in the
> > direction of long, complex, multiline one-liners? Or avoiding tempo
On Sat, Dec 7, 2013 at 1:28 PM, Steven D'Aprano
wrote:
> As for readability, I accept that ternary if is unusual compared to other
> languages...
All the C-derived ternary operators put the condition first, but
Python puts the condition in the middle. What that does for
readability I don't really
On Fri, 06 Dec 2013 17:20:27 -0700, Michael Torrie wrote:
> On 12/06/2013 05:14 PM, Dan Stromberg wrote:
>> I'm thinking mostly of stackoverflow, but here's an example I ran into
>> (a lot of) on a job:
>>
>> somevar = some_complicated_thing(somevar) if
>> some_other_complicated_thing(somevar) el
On Fri, 06 Dec 2013 15:54:22 -0800, Dan Stromberg wrote:
> Does anyone else feel like Python is being dragged too far in the
> direction of long, complex, multiline one-liners? Or avoiding temporary
> variables with descriptive names? Or using regex's for everything under
> the sun?
All those t
In article ,
Joel Goldstick wrote:
> Aside from django urls, I am not sure I ever wrote regexes in python. For
> some reason they must seem awfully sexy to quite a few people. Back to my
> point above -- ever try to figure out a complicated regex written by
> someone else?
Regex has a bad rap
On Fri, Dec 6, 2013 at 7:20 PM, Michael Torrie wrote:
> On 12/06/2013 05:14 PM, Dan Stromberg wrote:
> > I'm thinking mostly of stackoverflow, but here's an example I ran into (a
> > lot of) on a job:
> >
> > somevar = some_complicated_thing(somevar) if
> > some_other_complicated_thing(somevar) e
On 12/06/2013 05:14 PM, Dan Stromberg wrote:
> I'm thinking mostly of stackoverflow, but here's an example I ran into (a
> lot of) on a job:
>
> somevar = some_complicated_thing(somevar) if
> some_other_complicated_thing(somevar) else somevar
>
> Would it really be so bad to just use an if statem
On Fri, Dec 6, 2013 at 4:10 PM, Michael Torrie wrote:
> On 12/06/2013 04:54 PM, Dan Stromberg wrote:
> > Does anyone else feel like Python is being dragged too far in the
> direction
> > of long, complex, multiline one-liners? Or avoiding temporary variables
> > with descriptive names? Or using
On 12/06/2013 04:54 PM, Dan Stromberg wrote:
> Does anyone else feel like Python is being dragged too far in the direction
> of long, complex, multiline one-liners? Or avoiding temporary variables
> with descriptive names? Or using regex's for everything under the sun?
>
> What happened to using
On 12/6/13 6:54 PM, Dan Stromberg wrote:
Does anyone else feel like Python is being dragged too far in the
direction of long, complex, multiline one-liners? Or avoiding temporary
variables with descriptive names? Or using regex's for everything under
the sun?
What happened to using classes?
29 matches
Mail list logo