I must add a function for creating 3D textures. I am using snail case in the entire module.
My choices are:
def texture_3d(...):
pass
def texture_3D(...):
pass
def texture3D(...):
pass
I am not interested in opinions: which one looks better. I need a few references to other modules to see the best practice.
Please mention at least 1 module having similar functions.
PEP 8 states lowercase with underscore separation between words for function names. Now, because it seems opinionated if 3d
/3D
is an actual word, you'll get conflicts between the names texture_3d
and texture3d
(with d
being lowercase).
Looking at a number of numpy functions, for example, lagval3d
, laggrid3d
, hermegrid3d
the name texture3d
looks like a good choice.
Searching for similar names in the matplotlib
docs yields a mixed result between <name>3d
and <name>_3d
.
In short, both these names seem to be accepted, based on two major packages. Boils down to personal choice between the two.
Rather than depending on mere human opinion, perhaps we could ask the horse? (As in 'getting it from the horse's mouth'.) In other words, use pylint
.
I modified your code so that it would generate fewer messages.
''' 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
The results of pylint were:
************* 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)
Which just leaves the option texture_3d
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With