Homepage
Close
Menu

Site Navigation

  • Home
  • Archive(TODO)
    • By Day
    • By Month
  • About(TODO)
  • Stats
Close
by chipro on 2019-10-22 (UTC).

I made a notebook with examples of cool Python features that either took me a long time to find out or were too intimidating for me to use.

I especially focus on the features I find useful for machine learning.https://t.co/7LBmu4UuwS

— Chip Huyen (@chipro) October 22, 2019
pythonlearning
by jeremyphoward on 2019-10-22 (UTC).

Here's the nbviewer link, since github has so much trouble rendering notebooks (including this one!)https://t.co/lSxdNtsQb7

— Jeremy Howard (@jeremyphoward) October 22, 2019
pythonlearning
by jeremyphoward on 2019-10-22 (UTC).

Here's a little trick:
```
import operator
product = reduce(operator.mul, nums)
```

— Jeremy Howard (@jeremyphoward) October 22, 2019
pythontip
by jeremyphoward on 2019-10-22 (UTC).

Another trick:
```
def flatten (x): return list(itertools.chain.from_iterable(x))
```
NB: the `sum` approach to this is *very* slow on long lists! :O

— Jeremy Howard (@jeremyphoward) October 22, 2019
pythontip
by jeremyphoward on 2019-10-22 (UTC).

Number 5, `import *`, is only true if the package author hasn't defined `__all__`. Packages designed for use in a REPL should endeavor to always define this carefully - e.g. every fastai module does.

If you're using such a package in a REPL, `import *` can save a lot of bother!

— Jeremy Howard (@jeremyphoward) October 22, 2019
pythontip

Tags

learning tutorial misc nlp rstats gan ethics research dataviz survey python tool security kaggle video thought bayesian humour tensorflow w_code bias dataset pytorch cv tip application javascript forecast swift golang rl jax julia gnn causal surey diffusion
© Copyright Philosophy 2018 Site Template by Colorlib