Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: perl equivalent of python's underscore?

by mojotoad (Monsignor)
on Oct 28, 2010 at 07:44 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://867929]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-24 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found