In my view it’s almost always better to stick to the style of the API your code interact with the most … I tend to make it conform with the existing predominant api
That could work, but personally, I think one should write code that conforms to surrounding code. Such as, other projects in an organisation. Regardless of which libraries which happen to be used internally. Put another way, I think that one should write code such that it creates the least amount of friction for whomever is most likely to read it apart from yourself. On this mailing list for example, there is really only one choice; PEP08. Likewise for open source projects. Simply because without a pervasive style, there is only one style that matters apart from your opinion. And unless you are working alone, your opinion doesn’t matter. On 12 July 2016 at 15:24, Justin Israel <[email protected]> wrote: > > On Tue, 12 Jul 2016, 4:01 AM Cesar Saez <[email protected]> wrote: > >> In my view it's almost always better to stick to the style of the API >> your code interact with the most, so it all looks homogeneous and familiar. >> > > I agree with this. I tend to make it conform with the existing predominant > api > > In this case pyqt/pyside is camel case, the entire maya api is camel case, >> maya commands are camel case (and a terrible example for anyone wanting to >> design an API, but you get the idea)... therefore my maya code is camel >> case. >> Same with qt stuff and getters/setters vs attributes/properties, qt is >> all about getters and setters so if I'm coding any kind of reusable >> view/model it makes sense to follow that style instead of going pythonic >> and being foreign to anyone using your library. >> >> tl:dr; It's not about following rules but making it easier for the next >> guy reading/using your code, make it familiar and consistent :) >> >> >> Other than that I agree with Fredrik, use a linter (and configure your >> version control system to run the linter on submission before code >> reviews), don't waste your time on this when your editor can show you the >> mismatches in realtime as you go... you will eventually get familiar with >> the style and the linter warning will dissapear, but your first week will >> be all about "rules" you never thought about. Also, and this comes from >> experience, feel free to ignore a few rules if it doesn't make sense in >> your codebase, most linters have options to blacklist rules per project >> (i.e. current/modern styleguides have moved to 120 chars per line instead >> of the good ol' 79 chars, or set a different number of blank lines before a >> function so you can use some spacing within your function without visually >> merging the code blocks). >> >> >> Cheers! >> C. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAPamJi85EiFY%2BXT7%3D6X_3gomXUgi-5%2Btq2eZV44pDzcsaeF%3Dmw%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAPamJi85EiFY%2BXT7%3D6X_3gomXUgi-5%2Btq2eZV44pDzcsaeF%3Dmw%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2KHvhS-8fBcvCEF5SO5xFuGiM8fhw39m%3D1pAboNdy02A%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2KHvhS-8fBcvCEF5SO5xFuGiM8fhw39m%3D1pAboNdy02A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Marcus Ottosson* [email protected] -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBqGLEynDVZcc%2BXd4ux0nx3%3DMbW2PCgpAXSVHOwBTDgzQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
