Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: The Law of Inconsistent Assumptions

by Corion (Patriarch)
on Oct 19, 2004 at 15:50 UTC ( [id://400567]=note: print w/replies, xml ) Need Help??


in reply to The Law of Inconsistent Assumptions

Just a note - I prefer the sprintf-style notation of string interpolation in Python, but there are also other, less cumbersome ways:

print "Hello",foo,"." # not quite the same output but close enough print "Hello %s." % (foo) # printf-style interpolation

Manually concatenating strings is soo low-level :-)

Replies are listed 'Best First'.
Re^2: The Law of Inconsistent Assumptions
by SpanishInquisition (Pilgrim) on Oct 20, 2004 at 20:02 UTC
    Obligatory Ruby example:

    puts "This post was brought to you by the number #{ x + 75 / y} and th +e letter #{q}";

    Arbitrary code execution, variables, anything.

    If you want printf, Perl has a nicer printf than the example Python syntax. Why? It looks like printf and is therefore nice and short :)

    Regardless, a language is not about keystrokes, it's about style. Python is too wordy for me, and not automagical enough.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found