This one made my day 🙂
[15:11] [SAS]_LCpl_DUKE: Did you know: The Navy takes now only not-swimmers.
[15:11] [SAS]_RSM_Spidey01: ?
[15:11] [SAS]_LCpl_DUKE: Yeah, they defend the war-ships longer…
[15:11] [SAS]_RSM_Spidey01: LOL
[15:12] [SAS]_LCpl_DUKE: the newest joke i got 5 minutes ago… 😉
I’ve been brushing up on Python for a little projectI’ve got in mind, so I’ve been cramming like a student at finals week. Python is a nice language but one I never put to use when I originally started learning it.
The thing I love the most about Python, is the doc strings, it’s such a great idea if you ask me.
--- def test(params):
... """ Simple test
...
... More detailed info about it"""
...
... print params
...
--- test.__doc__
' Simple testntnt More detailed info about it'
A poor example yes, but in actual usage the doc strings can be very useful. I also like it because it can be used to move inline-documentation (some times aka comments) into the body of the function, rather then being above it. And they are accessible at runtime with the __doc__ special method.
One thing I do wish Ruby had, is Doc Strings for methods, b/c then in IRB I could do a simple obj.methods.sort and follow up with checking a methods docstring rather then an intermixing of playful testing in IRB with looking it up in TFM.
With Python, it’s quite easy to go to interactive mode and use dir(obj) to get the methods an object responds to and any available __doc__ special methods to learn more about it, before we go RTFM hehe.