Posts

Showing posts from May, 2018

Python: Late Binding

Late binding, aka late evaluation is, good; it saves the machine time. Do not evaluate unless you need it. What then, if a system evaluate the file before no one is ever sure that the file would be used or not? Here is something that you can have a very strong opinion on. Would you want the system evaluating just by open()ing the file? Look at the following code in Python. This is just opening up a log file. import logging LOGFORMAT = '[ %(asctime)s ] %(filename)s ( %(lineno)d ): %(message)s ' logging.basicConfig( filename = 'log/books.log' , format = LOGFORMAT, datefmt = ' %Y - %m - %d %H : %M : %S ' , level = logging.DEBUG) I am just setting the filename for logging. The file name could just be anything. <code>dummy.txt</code>, <code>&gt; null</code> thing. Right? Then it took me a while decoding the error message that the Python is giving me. "Server error! The server encountered an inte