PyDAQmx icon indicating copy to clipboard operation
PyDAQmx copied to clipboard

Remove DAQmx_ prefix from module attributes

Open eric-wieser opened this issue 8 years ago • 3 comments

That way instead of doing this and causing arbitrary namespace pollution:

from PyDAQmx import *

DAQmx_Some_Function(DAQmx_SomeConstant)

We can use the safer

import PyDAQmx

PyDAQmx.Some_Function(PyDAQmx.SomeConstant)

eric-wieser avatar Jul 19 '16 17:07 eric-wieser

Great idea. Better yet, make the names comply with PEP8 so they're not so hard to type!

petebachant avatar Jul 20 '16 01:07 petebachant

Hi !

In the dev branch, I modify the init to add the name without the prefix. This modification is backward compatible (the from PyDAQmx import * will import the name with the prefix). Can you test it !

I hesitate to rename the function using the PEP8 for two reasons : the documentation is not available for Python but in C. The second reason is that functions are closer to C functions than to python functions. I have in mind to write real python function (for example to remove the byref and returns the value). In this case I will rename the function using the PEP8

Pierre

clade avatar Jul 20 '16 09:07 clade

In the dev branch, I modify the __init__ to add the name without the prefix.

Looks good to me!

eric-wieser avatar Jul 20 '16 23:07 eric-wieser