HNHacker News
TopNewBestAskShowJobs

pizzaburek

188 karma · joined October 4, 2015

submissionscomments
pizzaburek··on Stop Writing Dead Programs [video]
For my personal Python projects I set a hard limit in the 94-96 range. That's wide enough that I actualy adhere to it instead of just ignoring it.

PEP8's and Google style guide's limits of 79 and 80 are way to narrow for a language with 4 space identation. However PEP says that "it is okay to increase the line length limit up to 99 characters" while Google's 80 is just a soft limit that can be broken in certain cases like long URLs.

pizzaburek··on Comprehensive Python Cheatsheet (2018)
My personal opinion is that `list_` is among the worst possible variable names (together with `bar` and `foo`). It's non-descriptive, ugly, hard to recognize, looks scary to beginners and maybe worst of all it's easy to forget the underscore when typing.
pizzaburek··on Comprehensive Python Cheatsheet (2018)
Yes, although there is a saying that "every generator is an iterator, but not every iterator is a generator". But then again generator has a bunch of methods (close, gi_frame, gi_yieldfrom, throw, gi_code, gi_running, send) that iterators don't have... I really don't know if <iter> is correct enough here, or should I use <genr> (that I don't use anywhere else and could be confusing).
pizzaburek··on Comprehensive Python Cheatsheet (2018)

   MIND = BLOWN
pizzaburek··on Comprehensive Python Cheatsheet (2018)
Will look into it, thanks for info.
pizzaburek··on Comprehensive Python Cheatsheet (2018)
The whole cheatsheet is clearly in Python 3, where the same doc page that you linked states:

   Performing list(d) on a dictionary returns a list of all the keys used in the dictionary, in 
   insertion order ...
pizzaburek··on Comprehensive Python Cheatsheet (2018)
Because it's rendered directly from README.md. That way it's easier for me, because I don't have to render it every time I make a change (I make a lot of little edits all the time), and project's Github page (https://github.com/gto76/python-cheatsheet) always has the same content as webpage.
pizzaburek··on Comprehensive Python Cheatsheet (2018)

   >>> list(dict.fromkeys([3, 2, 1]))
   [3, 2, 1]
   >>> list(set([3, 2, 1]))
   [1, 2, 3]
pizzaburek··on 62% of Americans Have Under $1,000 in Savings, Survey Finds
Too bad that a far more interesting discussion about Libertarian communism got flagged (or at least is not visible on a main page). https://news.ycombinator.com/item?id=10351830
pizzaburek··on Comp Mark II: Simple 4-bit/1 Hz Virtual Computer
It takes too long to compile otherwise, and I didn't want people to give up during compilation... You can run 'make optimize' to use -O1