Hi everyone! Longtime lurker, hardly an expert, but I've been using
Python for various projects since 2007 and love it.
I'm looking for either (A) suggestions on how to do a very common
operation elegantly and Pythonically, or (B) input on whether my
proposal is PEP-able, assuming there's no answe
Thanks for all the discussion on this. Very illuminating. Sorry for
the long delay in responding--deadlines intervened.
I will use the list comprehension syntax for the foreseeable future.
Tim, I agree with you about the slurping in final position--it's
actually quite surprising. As I'm sure you
On Aug 16, 4:39 pm, "Martin P. Hellwig"
wrote:
> On 03/08/2011 02:45, gc wrote:
>
>
> > a,b,c,d,e = *dict()
>
> > where * in this context means something like "assign separately to
> > all.
> . . . it has a certain code smell to it.
> I would
On Aug 17, 3:13 am, Chris Angelico wrote:
> Minor clarification: You don't want to initialize them to the same
> value, which you can do already:
>
> a=b=c=d=e=dict()
Right. Call the proposed syntax the "instantiate separately for each
target" operator. (It can be precisely defined as a * on th
On Aug 17, 5:45 am, Chris Angelico wrote:
(snip)
> > Right. Call the proposed syntax the "instantiate separately for each
> > target" operator.
>
(snip)
> It might just
> as easily be some other function call; for instance:
>
> head1,head2,head3=file.readline()
Hm--that's interesting! OK, call it
Hello,
I'm trying to do a if statement with a function inside it.
I want to use that variable inside that if loop , without defining it.
def Test():
return 'Vla'
I searching something like this:
if (t = Test()) == 'Vla':
print t # Vla
or
if (t = Test()):
print t # Vla
---
On 24 apr, 12:11, Steven D'Aprano wrote:
> On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
> > Hello,
>
> > I'm trying to do a if statement with a function inside it. I want to use
> > that variable inside that if loop , without defining it.
>
> &g
On 24 apr, 12:15, Chris Rebert wrote:
> On Fri, Apr 24, 2009 at 3:00 AM, GC-Martijn wrote:
> > Hello,
>
> > I'm trying to do a if statement with a function inside it.
> > I want to use that variable inside that if loop , without defining it.
>
> > d