Python Forum
Is a good practice naming user defined python functions with prefix udf_? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: Is a good practice naming user defined python functions with prefix udf_? (/thread-41716.html)



Is a good practice naming user defined python functions with prefix udf_? - meerkat - Mar-06-2024

As we know, usually python user defined functions are named like get_record_count(), add_numbers(). But to make the functions easy to search and manage, especially when the functions are not in a dedicated py file, but with main logic in a single file, is it a good practice naming them with a prefix, like udf_get_record_count(), udf_add_numbers()?
Is it against PEP8?
Thank you!


RE: Is a good practice naming user defined python functions with prefix udf_? - Gribouillis - Mar-06-2024

(Mar-06-2024, 06:17 PM)meerkat Wrote: is it a good practice naming them with a prefix
I don't think it is pythonic. It is better to use qualified names, for example if udf is a submodule of your project, you can use udf.get_record_count(), udf.add_number() etc


RE: Is a good practice naming user defined python functions with prefix udf_? - buran - Mar-09-2024

I don't see any added benefit, just extra typing. all functions in the module are "user defined"