gary_kramlich ([info]gary_kramlich) wrote,
@ 2005-10-13 02:10:00
Previous Entry  Add to memories!  Tell a Friend  Next Entry
Planet Guifications
Well John ([info]rekkanoryo10000) noticed last night that his name wasn't showing up and neither was his feed. It turns out that the planet software junks an entire feed if it has really old entries. He had entries dating back to 2003, so I just commented out the code in planetlib.py. I'm still kind of freaked out that """ in python is the same as /* in C. That just seems excessive. Speaking of retarded comments, why is it that these uber high level languages use ' and " as comment characters? Can anyone explain this to me? I mean is it really that difficult to hit // (no modifiers) than ' or " (which has a modifier...)</rant>



(4 comments) - (Post a new comment)


(Anonymous)
2005-10-13 02:37 pm UTC (link)
In C, isn't /* */ for commenting? In python """ """ is used for long strings where newlines, etc are taken as litterally that.

(Reply to this) (Thread)


[info]gary_kramlich
2005-10-19 10:41 am UTC (link)
No idea... I don't use python, i just had to tweak some code and """ seemed to work, and seeing how i saw it earlier in the code...

(Reply to this) (Parent)(Thread)


[info]nikolasco
2006-01-20 03:16 pm UTC (link)
Yes, ', ", and """ form string literals in Python. The only other language with """ that I know of is S2 (the LJ style language).

' is commonly used to prevent string interpolation. For example, "Hello, $foo" would replace $foo with the value of the variable. 'Hello $foo' would just pring the string as it appears. As far as I know, this is true of Bash, Perl, PHP, and Ruby. In Python, you prefix the string with r (e.g. r"no newline!\n")

(Reply to this) (Parent)


[info]nikolasco
2006-01-20 03:48 pm UTC (link)
Er, and the comment character is #
print 'this' #ignore the rest

When the string isn't used in a larger expression (assignment, function call) and Python basically ignores it. By convention, if the first statement in a function is a free-standing string then it's considered to be documentation for the function:
def foo():
    "This is a very simple function that does stuff and things"
    print "Hello world!"
This is also common in Lisp

(Reply to this) (Parent)


(4 comments) - (Post a new comment)

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…