Steve Holden wrote:
Excuse me, these are supposed to be IMPROVEMENTS to Python?
I think it's more messing around before coming to the conclusion that, of the
many things that 'where' helps with, this sure as hell ain't one of them :)
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Bri
On Sat, 08 Jan 2005 18:30:25 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote:
>Carl Banks wrote:
>> Right. But you know that as soon as you add this to simple
>> expressions, a bunch of people are going to come here whining about how
>> they don't get to use where with if-expressions.
So why should
Nick Coghlan wrote:
Carl Banks wrote:
What if the condition you wanted to test wasn't the same as the thing
you want to save? In other words, how would you convert this?
. where:
. m = something()
. if m > 20:
. do_something_with(m)
Yeah, this problem eventually occurred to me as well. Ho
Carl Banks wrote:
As a compromise, howabout:
. if m > 20 where m=something():
. do_something_with(m)
That's good, but first idea was about 'where' block that contains any
expressions, that we need, for example function definition. the syntax
you proposed has same problems as 'lambda'.
The ma
Donn Cave wrote:
> If Python 3 is going to get assignment-as-expression, it will be
> because GvR accepts that as a reasonable idea. You won't bootleg it
> in by trying to hide it behind this "where" notion, and you're not
> doing "where" any good in trying to twist it this way either.
I suspect
Carl Banks wrote:
I'm sorry, I really can't agree that this helper function "solves" it.
IMO, it's a workaround, not a solution. And, if I may be frank, it's a
pretty ugly one.
Heck, I thought it was ugly and I wrote it :)
So in reality, I'd continue to use the nested-if approach that works right
Quoth "Carl Banks" <[EMAIL PROTECTED]>:
...
| As a compromise, howabout:
|
| . if m > 20 where m=something():
| . do_something_with(m)
|
| In this case, the m=something() is NOT an assignment statement, but
| merely a syntax resembling it. The "where m=something()" is part of
| the if-statemen
Nick Coghlan wrote:
> Carl Banks wrote:
> > What if the condition you wanted to test wasn't the same as the
thing
> > you want to save? In other words, how would you convert this?
> >
> > . where:
> > . m = something()
> > . if m > 20:
> > . do_something_with(m)
>
> Yeah, this problem even
Carl Banks wrote:
What if the condition you wanted to test wasn't the same as the thing
you want to save? In other words, how would you convert this?
. where:
. m = something()
. if m > 20:
. do_something_with(m)
Yeah, this problem eventually occurred to me as well. However, I think a litt
Nick Coghlan wrote:
> I have a different suggestion for this.
>
> 'as' is used for renaming in import statements. 'as' will be used for
exception
> naming in Python 3k.
>
> So let's use it for expression naming in 'if' statements, too.
>
> if someregexp.match(s) as m:
># blah using m
> elif som
Nick Coghlan <[EMAIL PROTECTED]> writes:
> So let's use it for expression naming in 'if' statements, too.
>
> if someregexp.match(s) as m:
># blah using m
> elif someotherregexp.match(s) as m:
># blah using m
Certainly an improvement over what we have now.
--
http://mail.python.org/mailm
Carl Banks wrote:
Right. But you know that as soon as you add this to simple
expressions, a bunch of people are going to come here whining about how
they don't get to use where with if-expressions.
Frankly, they might have a point here. Although we have replacing
lambda expressions on our minds,
12 matches
Mail list logo