473,781 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Doc strings for a standalone app??

Does it make sense to use doc strings rather than #-comments for a
standalone Python app? If the classes aren't going to be re-used or
imported, do they need them?
Jul 18 '05 #1
4 1705
j_mckitrick wrote:
Does it make sense to use doc strings rather than #-comments for a
standalone Python app? If the classes aren't going to be re-used or
imported, do they need them?

Sure. They are more clear as to the assignment of the comment to a
particular class or function or method, for one thing. It can help when
debugging and/or testing your modules, for another thing. And, you never
know that you'll always release as a standalone, as you might change your
mind or release some of your modules for third-party usage, for a third
thing.
--

Jul 18 '05 #2
j_mckitrick wrote:
Does it make sense to use doc strings rather than #-comments for a
standalone Python app? If the classes aren't going to be re-used or
imported, do they need them?


The only thing I can think of to ask about that is "Why
would you *not* want to use doc strings?". There is
no significant overhead associated with them, so you
don't really lose. They have potential advantages, given
that the docs are available at runtime, more clearly
identifiable as documentation, etc, whereas the other
form of comments have no advantages for this kind of
thing. So why not use them?

-Peter
Jul 18 '05 #3
Calvin Spealman <ca****@ironfro ggy.com> wrote in message news:<ma******* *************** *************** @python.org>...
j_mckitrick wrote:
Does it make sense to use doc strings rather than #-comments for a
standalone Python app? If the classes aren't going to be re-used or
imported, do they need them?

Sure. They are more clear as to the assignment of the comment to a
particular class or function or method, for one thing. It can help when
debugging and/or testing your modules, for another thing. And, you never
know that you'll always release as a standalone, as you might change your
mind or release some of your modules for third-party usage, for a third
thing.
--


How do they help during debugging/testing?
Jul 18 '05 #4
The only perceived disadvantages that I'm aware of occur when you don't
use the -OO flag. Docstrings end up in frozen executables and .pyc
files, visible through the use of the "strings" command (which is a
problem for people who think the information is hidden from the binary
file like a comment). The binary files are also ever so slightly larger
when docstrings are used instead of comments. However, using -OO
removes docstrings in addition to applying optimizations.. .the frozen
executable or resulting .pyo files have no docstrings and are a bit smaller.

-Rick Ratzel

Peter Hansen wrote:
j_mckitrick wrote:
Does it make sense to use doc strings rather than #-comments for a
standalone Python app? If the classes aren't going to be re-used or
imported, do they need them?

The only thing I can think of to ask about that is "Why
would you *not* want to use doc strings?". There is
no significant overhead associated with them, so you
don't really lose. They have potential advantages, given
that the docs are available at runtime, more clearly
identifiable as documentation, etc, whereas the other
form of comments have no advantages for this kind of
thing. So why not use them?

-Peter

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2286
by: FilexBB | last post by:
Currently I use jdom-b9 version to parase xml with the following xml message <?xml version="1.0" encoding="UTF-8" standalone="no"?> ...... with the code like this SAXBuilder builder = new SAXBuilder(); InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("test.xml"); Document doc = builder.build(is);
2
5437
by: Lonnie, SRC employee | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** I can figure out how to set the standalone attribute in the <? xml version="1.0 ?> tag eg <?xml version="1.0" standalone="yes" ?> closest I have got to what I need is: <?xml version="1.0" ?> <?standalone yes?> <xpg creator="crusher" version="1.0"> <etr>
9
2051
by: Dan Williams | last post by:
Hi people I'm getting a little annoyed with the way the print function always adds a space character between print statements unless there has been a new line. The manual mentions that "In some cases it may be functional to write an empty string to standard output for this reason." Am I the only the who thinks that this sucks? It's the first thing I've come across in Python that I really think is a design flaw. Is there a good way to...
3
2878
by: Isaac Gouy | last post by:
1) Running a standalone script with SpiderMonkey on Linux js -f scriptfile.js scriptarg How can I get the value of scriptarg from within the JavaScript scriptfile? 2) Running a standalone script with SpiderMonkey on Linux How can I do formated printing to stdout?
0
309
by: tt | last post by:
My mod_python 3.1.4 installation works when Apache 2.0.54 is run in standalone mode (apache -k standalone) but refuses to operate when run as a service (apache -k restart). Logs yield the usual and well-known "make_obcallback: could not import mod_python.apache" error. I have tried PYTHONHOME, LoadFile python24.dll (2.4.2) with no result. I have read *all* threads about make_obcallback that google found. What's even weirder I had this...
2
2366
by: JohnR | last post by:
Hi all. In my program I try to handle all obvious potential errors with structured error handling (try-catch) block. What I would like to do is have an 'overall' error handler that would gracefully catch any unanticipated errors. I created a startup module to place my overall error handling for my "real" program which is Form1. My program is structured like this: Module startup
1
1553
by: VK | last post by:
It is possibly more suitable to address this question to W3C mailing list, but I'm trying here first. Could anyone comment on <http://www.w3.org/TR/REC-xml/#sec-rmd> The first statement says: "If there are external markup declarations but there is no standalone document declaration, the value "no" is assumed."
7
11666
by: tah | last post by:
Hey, Can someone please clarify, confirm, or set me straight on my understanding of a standalone="yes" attribute in the xml version element? I assume it means that the xml document containing it is standalone, and does not refer to any external document to define types. In other words, it doesn't use an external dtd to validate any types - everything used would be defined within the doc itself. In other words, you would never see an xml...
14
2247
by: Karch | last post by:
I need to find the fastest way in terms of storage and searching to determine if a given string contains one of a member of a list of strings. So, think of it in terms of this: I have a string such as the following: "Smith said the dog belongs (or did belong) to the secretary, an employee of the company." Then the list contains the following (and this list is MUCH larger in the real situation):
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8964
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.