Home > OS >  Best practice naming convention for lists created from database table fields in python
Best practice naming convention for lists created from database table fields in python

Time:02-16

I am creating two separate lists in which the elements are coming from the same table which is in mysql database. Some fields of the table i am storing in one list while the other fields in another list. As you see the naming of these lists look bad to me and hence i am thinking what could be the best naming convention in python i can give to these lists.

table_info1 = [source_system, filter_column, start_date, end_date, storage_account, database, table, dc,
                           environment, min_ts]
  
table_info2 = [target_container, last_run_date, history_load, source_table_type, source_sub_system,
                           username, password, azure_key, interval_days, key_str, schedule_tag]

CodePudding user response:

According to python's PEP 8: Function and Variable Names variable names should be lowercase, with words separated by underscores as necessary to improve readability. mixedCase is allowed only in contexts where that's already the prevailing style (e.g. threading.py), to retain backwards compatibility.

Therefore, the names of your lists should be meaningful variable names (what does each list represent?) in lowercase, separated by underscores, without numbers.

CodePudding user response:

Call them source_info and target_info

  • Related