Python Forum
Is a good practice naming user defined python functions with prefix udf_?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is a good practice naming user defined python functions with prefix udf_?
#1
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!
Reply
#2
(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
buran likes this post
« We can solve any problem by introducing an extra level of indirection »
Reply
#3
I don't see any added benefit, just extra typing. all functions in the module are "user defined"
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  best practice example data science mostafa705 1 768 Oct-13-2023, 04:44 AM
Last Post: KianLynch
  find out ore python is good for me ? trix 2 1,108 Mar-26-2023, 02:13 PM
Last Post: trix
  Is Python Good for GUI Desktop Application? praveencqr 0 813 Dec-23-2022, 07:02 AM
Last Post: praveencqr
  Is being a Python Developer a good career choice? ankitdixit 1 2,177 May-31-2021, 05:13 AM
Last Post: ankitdixit
  Request for [PyGTK] or [GTK] prefix in GUI forum Lomax 2 2,034 Jan-30-2021, 12:06 AM
Last Post: Axel_Erfurt
  Practice coding through hackathon!! TheOutcast 0 1,454 Jun-11-2020, 12:03 PM
Last Post: TheOutcast
  Learning Python - good free online resources & courses StickyBrickit 1 2,459 Jun-04-2020, 11:31 AM
Last Post: Larz60+
  Recommendation for good Python project and code to study kmiklas 1 2,420 Jan-16-2020, 10:53 PM
Last Post: Larz60+
  good names for these functions Skaperen 0 1,287 Dec-30-2019, 02:24 AM
Last Post: Skaperen
  WHich is a good site/tutorial to learn Python for beginners? deepakdeshp 7 4,991 Oct-11-2019, 06:46 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020