How to reduce size after PEP8 rules?

I have to add a function to create 3D textures. I use a snail case in the entire module.

My options are:

def texture_3d(...):
    pass

def texture_3D(...):
    pass

def texture3D(...):
    pass

What should the function name be?

I am not interested in opinions: which one looks better. I need some links to other modules in order to get acquainted with the best practice.

Indicate at least one module that has similar functions.

+4
source share
4 answers

, , , ? ( " ".) , pylint.

, .

''' some information here'''

def texture_3d(parameters):
    ''' a docstring'''
    return parameters

def texture_3D(parameters):
    ''' a docstring'''
    return parameters

def texture3D(parameters):
    ''' a docstring'''
    return parameters

pylint :

************* Module temp
C:  7, 0: Invalid function name "texture_3D" (invalid-name)
C: 11, 0: Invalid function name "texture3D" (invalid-name)

------------------------------------------------------------------
Your code has been rated at 6.67/10 (previous run: 5.00/10, +1.67)

texture_3d.

+4

PEP-8:

: , , .

, .

+3

: texture_3d.

PEP-8 :

, , , .

mixedCase is only allowed in contexts where it is already the prevailing style (e.g. threading.py) to maintain backward compatibility.

Since “texture” and “3d” are two separate words, it is advisable to set an underline between them. In addition, the function name must be lowercase, therefore 3Dnot allowed.

+3
source

Source: https://habr.com/ru/post/1679572/


All Articles