LordOfThunder

310
reputation
1
3
17

$\bullet~$ I am an Undergraduate student, currently in prefinal year. $\bullet~$ I love Number theory and Quantum Physics also. $\bullet~$ I like thought experiments .

  • Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. . - Sherlock Holmes
  • ''Don't bother just to be better than your contemporaries or predecessors. Try to be better than yourself.'' - William Faulkner
  • All that is gold doesn't glitter.

$\blacktriangleright ~~$ A survey titled "Why we do mathematics"

Collection of QAs

  • How sorted(list, key) works in Python 3
  • Difference between data type and data structure
  • Combination/Superset using itertools
  • Use dis module to see how a program executes in Python. Note: The execution may change in a newer version of Python, so analyzing with previous experience may not work.
  • Python library for text wrapping and filling(textwrap)
  • To increase the recursion limit in Python, we can use sys.setrecursionlimit(10000)
  • To know how much memory is used in a function, we need to use the decorator @profile above the function definition and to make it work, we need to install memory-profiler (command: pip install memory-profiler). Then, to know the result, run the source code from cmd(in Windows) using the command: python -m memory_profiler myscript.

  • Python recursion visualizer

  • To bitmask pyhton list, we can use itertools.compress(list, mask). Another way is to use zip with the mask and the iterable as parameters - list([var for mask_bit, var in zip(mask, elems) if mask_bit]

  • Method resolution order in case of multiple inheritances follows depth-first until classes are encountered that will share a parent, and then breadth-first over those in simple word. It actually follows C3 linearisation