Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Really the hard way?

https://hg.python.org/cpython/file/3.5/Lib/collections/__ini... Knowing specialized data structure in a language is always important and this is well coded.

Well see the 2 lines I pointed in one of the standard library in python and you will understand that even in good language there will always be dust under the carpet at one point. https://hg.python.org/cpython/file/5c3812412b6f/Lib/email/_h...



Thanks for the recommendations, I think they may be a bit above me at the moment (I don't have enough knowledge of Python to be able to identify dust under the carpet :)

But you did teach me one thing, I didn't know that the """ could be used for commenting. I thought it was only for multi-line print statements.

These are exactly the type of things I hope to learn while code-reading.

Cheers!


Even better: If you put the string right after your function/class definition, python automatically assigns it to the `__doc__` attribute of the object. This is how the `help` function works.


Thanks!

As ironic(?) as this sounds, where is this doc feature documented?

(Part of my learning is that I am trying hard to learn how to navigate the various Python documentation. For example, I had a hell of a time trying to find a list of format strings, as different sources refer to it as different things)


PEP-257 is where you can find documentation on them.

https://www.python.org/dev/peps/pep-0257/


Thanks for that, and thank you for getting me into the whole PEP. Previously I had only heard about PEP 8, and I thought that was just it , an opinionated piece about how to write Python. Now I have a whole other source of information to look at.

And for people who will no doubt call me out on this, I have been working on Zed's LPtHW for about a month. I have done numerous searches regarding Python problems, and this is literally the first time I have come across a PEP reference to look at beside PEP 8.


The features added in PEPs should be incorporated into the documentation -- if they're not, please file a bug -- so people mostly don't refer to PEPs except for historical purposes.

It's not code, but also see Raymond Hettinger's talk "Beyond PEP 8" on YouTube. Actually, pretty much any talk by Hettinger is worth watching:

http://pyvideo.org/speaker/138/raymond-hettinger


PEPs are basically the Python community's RFCs (if you're familiar with those).

BTW, what you call "an opinionated piece on how to write Python" was originally written by Guido van Rossum, the guy who invented Python in the first place. I think that gives him the right to say something on the topic...

(You ought to know that Python has a large following with a strong community feeling. Making negative remarks about their BDFL - benevolent dictator for life - van Rossum does not go down well ;-) )


I do know the idea behind RFCs.

And I hope that other people don't think I used the wording 'opinionated' in a negative way. I do know about the concept of a BDFL, and I do know that Guido was behind those comments.

But I still stand behind my assessment that the PEP 8 comments are opinionated. And maybe rightly so. ;)


Doesn't Guido himself preface some of the things in PEP8 as being his pet peeves?


I think you'll find lots of people in the Python community who think that Python 3 was a mistake, that GvR's insistence on artificially weakening lambdas is a mistake, etc. Disagreeing with style is pretty minor.

Doesn't make it any less of a community. Families can disagree with each other and still love each other.


For the benefit of other novice like me, here [0] is the index for all PEPs.

[0]https://www.python.org/dev/peps/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: