Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: perl equivalent of python's underscore?

by mojotoad (Monsignor)
on Oct 28, 2010 at 07:44 UTC ( #867929=note: print w/ replies, xml ) Need Help??


in reply to perl equivalent of python's underscore?

Your question has more to do with scoping and syntax.

Scope:
Python scoping is not like Perl's. It's similar, but forget about 'brackets'. It's about function defs and where they happen.
Syntax:
The underscore '_' in Python is not special, it just happens to be a valid variable name. In conjunction with scoping, this has become short-hand for for a 'disposable' variable. Given the 'fill the slots' nature of assignment in Python, this turns out to be pretty useful, and therefore an idiomatic pythonic thing to do.

And yes, I've had to go play on the dark side here and there.

Cheers,
Matt


Comment on Re: perl equivalent of python's underscore?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://867929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-08-30 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls