bnsagar90

Python learning

Jun 3rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. @staticmethod function is nothing more than a function defined inside a class. It is callable without instantiating the class first. It’s definition is immutable via inheritance.
  2.  
  3. @classmethod function also callable without instantiating the class, but its definition follows Sub class, not Parent class, via inheritance. That’s because the first argument for @classmethod function must always be cls (class).
  4.  
  5. http://www.jakubkonka.com/2012/09/02/lazy-evaluation-python.html
  6.  
  7. Regex:-
  8. https://blog.codinghorror.com/regex-performance/
  9. https://www.loggly.com/blog/five-invaluable-techniques-to-improve-regex-performance/
  10. https://www.loggly.com/blog/regexes-the-bad-better-best/
  11.  
  12. In this book, the terms “script” and “program” are used interchangeably,
  13. with a slight preference for “script” to describe a simpler top-level file, and “program”
  14. to refer to a more sophisticated multifile application.
  15.  
  16. the standard implementations of Python today compile (i.e., translate) source code statements
  17. to an intermediate format known as byte code, and then interpret the byte
  18. code. Byte code provides portability, as it is a platform-independent format.
  19.  
  20. Python’s standard library comes with POSIX bindings a
  21.  
  22. communicate over XML-RPC, SOAP, and Telnet; and more. Python’s libraries make these
  23. tasks remarkably simple.
  24.  
  25. the mod_python package runs
  26. Python efficiently within the Apache web server.
  27.  
  28. such as Django, TurboGears,
  29. Pylons, Zope, and WebWare, support quick construction of full-featured and
  30. production-quality web sites with Python
  31.  
  32. when you execute a program, Python first compiles your source code (the statements in your file) into a format
  33. known as byte code. The compilation is simply a translation step, and byte code is a lower-level, platform-independent representation of your source code. Roughly, Python translates each of your source statements into a group of byte code instructions by decomposing them into individual steps. This byte code translation is performed to speed execution—byte code can be run much more quickly than the original source code statements in your text file.
  34.  
  35. If Python cannot write the byte code files to your machine, your program still works—the byte code is generated in memory and simply discarded on program exit.*However, because .pyc files speed startup time, you’ll want to make sure they are
  36. written for larger programs. Byte code files are also one way to ship Python programs—Python is happy to run a program if all it can find are .pyc files, even if the original .py source files are absent. (See “Frozen Binaries” later in this chapter for another shipping option.)
Add Comment
Please, Sign In to add comment