(Apr-23-2017, 11:19 PM)volcano63 Wrote: (Apr-23-2017, 11:13 PM)wavic Wrote: Don't know. The English is not my native language. :)
Just follow as close as you can PEP 8 :D
Mine neither
. Is yours Spanish - as you imply? I would vouch for Russian
.
And I was known to boldly go against pylint
- especially the part that forbids using mutable as default value (caching, you know).
If you guys are non-native English speakers, you're both doing great. I can understand you perfectly. As I get more skilled in Python, I'm going to be looking for ways to add support for multiple languages to the utilities that I write. In addition to English (my native language), I speak German and French. Those are two languages I certainly want to support in my applications, but I would also like to support languages I don't speak, especially Spanish, simply because so many people speak it. Therefore, I'll be looking for ways to code that make supporting multiple languages efficient. Thanks for learning English.
(Apr-29-2017, 05:35 PM)nilamo Wrote: (Apr-23-2017, 02:51 AM)Luke_Drillbrain Wrote: I could stick with Hungarian if there's enough of an advantage to doing so. On the other hand, if it would be an advantage to working with other GNU freeware authors, I could junk it. The code, of course, runs regardless of how you name your variables.
I don't see the value of declaring everything at the top of a function, nor do I see value in hungarian notation. But I DO see value in functions that are very short, 15 lines or less, with a fairly hard maximum at roughly however big your editor is, so you can see all of the function all at once.
The best place to find out what recommended conventions are, is PEP8: https://www.python.org/dev/peps/pep-0008/
But as for open source projects, the best thing you can do is learn that different people like code that looks however they like looking at it. Whichever project you find interesting might have a different convention than other things, and it's more important for you to stick with whatever that project is already doing.
I did find some value in Hungarian notation for keeping track of what data type and scope my variables were, but I don't think it's so essential that I couldn't live without it. Your advice about coding as much as possible in the style of the original GNU freeware author seems reasonable to me. If I can create a feature that improves a piece of software, I would hope that the original author would adopt my code so that all can benefit.
In any event, this is a great forum. I really appreciate everyone's helpful input.