कई अजगर आईडीई के आप की तरह एक टेम्पलेट के साथ शुरू होगा: पर्याप्त नहीं है यही कारण है किसबसे अच्छा पायथन पुस्तकालय मॉड्यूल कंकाल कोड क्या है?
print 'hello world'
... तो यहाँ इस सवाल का आरंभ करने के लिए मेरी कंकाल कोड है:
मेरी मॉड्यूल कंकाल, लघु संस्करण:
#!/usr/bin/env python
"""
Module Docstring
"""
#
## Code goes here.
#
def test():
"""Testing Docstring"""
pass
if __name__=='__main__':
test()
और,
मेरी मॉड्यूल कंकाल, लांग संस्करण:
0,123,#!/usr/bin/env python
# -*- coding: ascii -*-
"""
Module Docstring
Docstrings: http://www.python.org/dev/peps/pep-0257/
"""
__author__ = 'Joe Author ([email protected])'
__copyright__ = 'Copyright (c) 2009-2010 Joe Author'
__license__ = 'New-style BSD'
__vcs_id__ = '$Id$'
__version__ = '1.2.3' #Versioning: http://www.python.org/dev/peps/pep-0386/
#
## Code goes here.
#
def test():
""" Testing Docstring"""
pass
if __name__=='__main__':
test()
नोट्स (PEP 8, UTF-8):
"""
===MODULE TYPE===
Since the vast majority of my modules are "library" types, I have constructed
this example skeleton as such. For modules that act as the main entry for
running the full application, you would make changes such as running a main()
function instead of the test() function in __main__.
===VERSIONING===
The following practice, specified in PEP 8, no longer makes sense:
__version__ = '$Revision: 1.2.3 $'
For two reasons:
(1) Distributed version control systems make it neccessary to include more
than just a revision number. E.g. author name and revision number.
(2) It's a revision number not a version number.
Instead, the __vcs_id__ variable is being adopted. This expands to, for
example:
__vcs_id__ = '$Id: example.py,v 1.1.1.1 2001/07/21 22:14:04 goodger Exp $'
===VCS DATE===
Likewise, the date variable has been removed:
__date__ = '$Date: 2009/01/02 20:19:18 $'
===CHARACTER ENCODING===
If the coding is explicitly specified, then it should be set to the default
setting of ASCII. This can be modified if necessary (rarely in practice).
Defaulting to UTF-8 can cause anomalies with editors that have poor unicode
support.
"""
वैकल्पिक कंकाल, लांग संस्करण: (। कोड DasIch के जवाब से अनुकूलित)
#!/usr/bin/env python
# -*- coding: ascii -*-
"""
package.module
~~~~~~~~~~~~~
A description which can be long and explain the complete
functionality of this module even with indented code examples.
Class/Function however should not be documented here.
:copyright: year by my name, see AUTHORS for more details
:license: license_name, see LICENSE for more details
"""
#
## Code goes here.
#
def test():
""" """
pass
if __name__=='__main__':
test()
Peps का एक बहुत हैं जो आगे कोडिंग शैली सिफारिशों डाल दिया। क्या मुझे कोई महत्वपूर्ण सर्वोत्तम प्रथाएं याद आ रही हैं? सबसे अच्छा पायथन मॉड्यूल कंकाल कोड क्या है?
अद्यतन
मुझे किसी भी प्रकार का "सर्वश्रेष्ठ" दिखाएं जो आप पसंद करते हैं। हमें बताएं कि आपने "सर्वश्रेष्ठ" अर्हता प्राप्त करने के लिए किस मीट्रिक का उपयोग किया था।
"सर्वश्रेष्ठ" थोड़ा अस्पष्ट लगता है, शायद आप अपने प्रश्न को स्पष्ट कर सकते हैं। – Francesco
मैं सर्वश्रेष्ठ बेसलाइन कंकाल कोड के लिए सर्वसम्मति चाहता हूं। अन्यथा, मैं सिर्फ यह जानने के लिए बसूंगा कि हर कोई क्या उपयोग करता है। – user213060
@ उपयोगकर्ता213060: "सर्वोत्तम आधारभूत के लिए"। "सर्वश्रेष्ठ" का क्या अर्थ है? कम से कम? सबसे तेजी से? सबसे सरल? ज्यादातर विशेषताएं? विशालतम? अधिकांश दस्तावेज़ीकरण? Django के साथ निकटतम फिट? WSGI? "सर्वश्रेष्ठ" का क्या अर्थ है? कृपया अपने प्रश्न को सर्वोत्तम परिभाषा के साथ अद्यतन करें।कृपया अपने प्रश्न के लिए टिप्पणियां न जोड़ें। –