Update 'PYGUIDE.md'
This commit is contained in:
parent
43a0e86492
commit
508fefa3d0
53
PYGUIDE.md
53
PYGUIDE.md
|
@ -93,4 +93,55 @@ always access your variable throught the method and avoid to access directly.
|
|||
def operation(self, first_param, second_param):
|
||||
return self.object_attribute * 2
|
||||
|
||||
```
|
||||
```
|
||||
|
||||
Attributes with known units should be explicit in method's names
|
||||
|
||||
```python
|
||||
|
||||
@property
|
||||
def distance_m(self):
|
||||
return self._distance
|
||||
```
|
||||
|
||||
### Coments
|
||||
|
||||
#### code documentation
|
||||
|
||||
all public classes, properties and methods must have code comments
|
||||
|
||||
```python
|
||||
|
||||
class MyClass
|
||||
"""
|
||||
MyClass class perform models class operations
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
||||
@property
|
||||
def object_attribute(self):
|
||||
"""
|
||||
My class object attribute
|
||||
:return: int
|
||||
"""
|
||||
return self._object_attribute
|
||||
|
||||
def operation(self, first_param, second_param):
|
||||
"""
|
||||
multiplies object_attribute by two
|
||||
:return: int
|
||||
"""
|
||||
return self.object_attribute * 2
|
||||
|
||||
```
|
||||
|
||||
#### To do's
|
||||
|
||||
Pending to implement operations should be indicated with ToDo comments to highlight the missing operation
|
||||
|
||||
```python
|
||||
# ToDo: right now extracted at city level, in the future should be extracted also at building level if exist
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user