About comments on main.py source code

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
photoacoustic
Posts: 24
Joined: Mon Apr 27, 2015 8:25 am

About comments on main.py source code

Post by photoacoustic » Wed Oct 21, 2015 10:50 am

Dear all,
I would like to know if there is some recommendation about comments in source file.
Can I put much as I like without losing memory?
Thanks in advance for your comments and suggestions
Best regargs

Damien
Site Admin
Posts: 623
Joined: Mon Dec 09, 2013 5:02 pm

Re: About comments on main.py source code

Post by Damien » Wed Oct 21, 2015 11:14 am

Actual comments starting with a hash # are removed by the lexer and take no RAM. They only take space in the file itself. So you can write as many as you like.

Strings/doc-strings as comments do take some amount of RAM when compiling so better to avoid them.

photoacoustic
Posts: 24
Joined: Mon Apr 27, 2015 8:25 am

Re: About comments on main.py source code

Post by photoacoustic » Wed Oct 21, 2015 12:52 pm

Thank for the response

User avatar
kfricke
Posts: 342
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: About comments on main.py source code

Post by kfricke » Wed Oct 21, 2015 3:46 pm

Interesting to know. Can you recommend some '#'-based comment style for the generation of documentation from code? I am thinking of some drivers which might need some love and could generate nice "Read the Docs" documentation. I hope that is reasonable!?

Damien
Site Admin
Posts: 623
Joined: Mon Dec 09, 2013 5:02 pm

Re: RE: Re: About comments on main.py source code

Post by Damien » Wed Oct 21, 2015 4:12 pm

kfricke wrote: Can you recommend some '#'-based comment style for the generation of documentation from code?
I'd put restructured text in the comments. Easy to extract (just strip leading #) and then pass to sphinx.

Post Reply