Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What variable name do you use for file descriptors?

A pretty silly trivial question. The canonical example is f = open('filename'), but

  • f is not very descriptive. After not looking at code in a while, you can forget whether it means "file" or "function f(x)" or "fourier transform results" or something else. EIBTI.
  • In Python, file is already taken by a function.

What else do you use?

like image 904
endolith Avatar asked Sep 13 '09 22:09

endolith


People also ask

What are file descriptors in Python?

File descriptors are a low-level facility for working with files directly provided by the OS kernel. A file descriptor is an integer that identifies the open file in a table of open files kept by the kernel for each process.

Do variable names have to be descriptive?

The variable name must describe the information represented by the variable. A variable name should tell you concisely in words what the variable stands for. Your code will be read more times than it is written. Prioritize how easy your code is to read over than how quick it is to write.


1 Answers

 data_file
 settings_file
 results_file
 .... etc
like image 145
Aziz Avatar answered Nov 10 '22 10:11

Aziz