Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styling/coding standards #3

Open
Tirpitz93 opened this issue Apr 10, 2018 · 4 comments
Open

Styling/coding standards #3

Tirpitz93 opened this issue Apr 10, 2018 · 4 comments

Comments

@Tirpitz93
Copy link

Tirpitz93 commented Apr 10, 2018

Which coding standards/PEP guides are you planning to adhere to.
As this is a python library aimed at python users(presumably) the PEPs would be a good place to start.

Also when implementing the classes there are a couple options regarding the OOP interface as I see it:

  1. literal translations so getPos player becomes player.getPos(). or player.get_pos()
  2. @property decorator to wrap the calls to the DLL to the user so that getPos player becomes player.pos , and player setPos [a,b,c] becomes player.pos = [a,b,c].
  3. Both of the above, having one approach call the other for example. This illustrates both approaches, and is therefor less pythonic ("one way to do something").
     class RV_Object(object):
        def __init__(self):
           # todo
           pass

        @property
        def pos(self)->tuple:pass

        @pos.setter
        def pos(self, pos:tuple)->None:pass

        def get_pos(self)->tuple: pass # todo

        def set_pos(self, pos:tuple)->None: pass # todo
@overfl0
Copy link

overfl0 commented Apr 10, 2018

Using PEP8 would be a good start ;).
I'd suggest doing as "everyone else does" and increasing the line size limit to 120 chars (with 1080p and even 4k monitors nowadays)

I'm sitting on a fence regarding the camelCase vs snake_notation. I'm used to snake but I also see the benefit of sticking to the original SQF function names. Deep inside me I'd prefer to stick with the original naming (less confusion) but I haven't done enough Arma modding (nor even used Intercept much) to speak authoritatively about this matter.

@Tirpitz93
Copy link
Author

Where do you guys stand on replacing get_* and set_* with a property?
If necessary adding aliases to the property.
Also what would the preferred naming convention/ namespace for the class names be?
RV_*
Intercept_*
Arma_*

@Tirpitz93
Copy link
Author

I have some boilerplate code here: https://github.com/Tirpitz93/intercept-python/tree/python_classes.

@jonpas
Copy link
Member

jonpas commented Apr 10, 2018

Intercept uses snake_case for all SQF wrappers as well, might as well do the same here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants