In-class discussion: Introductory workshop

No, A list comprehension does not call the append attribute and calls it as a function. Rather it uses bytecode to run a modified(optimized form) of append method.

3 Likes

list comprehension is a type of inline function

1 Like

Yes thats true! Test is for yourself, initiate a range(10000000) list and just do a square operation on every element and use %%time in your cell.

2 Likes

http://www.bogotobogo.com/python/python_fncs_map_filter_reduce.php

The map filter reduce blog post Jeremy showed ^

2 Likes

Most of time I have used the concept with apply function

You can also see the method docstring pressing shift+tab.

@jeremy arenā€™t you afraid that your ā€œCutting-edgeā€ new DS coding style might be counter-productive for students during interviews with old-time recruiters ?

6 Likes

These are actually standard stuff.

1 Like

Learn to write Python like poetry:
Idiomatic Python

It actually helped me get a DS role!

2 Likes

how can i export my anaconda environment to my aws instance

"a = np.array([1.73, 1.68, 1.71, 1.89]) ; a"
is standard code stuff ?

itā€™s just how to create a numpy array.

conda update --all will update to latest release in that version. I uninstalled Anaconda and installed Anaconda for Python 3.6

1 Like

the ā€œā€¦ ; aā€ on the same line ?

; or type command on the 2nd line. THis will execute each statement sequentially.

264 messages - mind blowing forum flow ā€¦

2 Likes

$ conda env export > environment.yml
$ conda env create -f environment.yml -n $ENV_NAME

You can add the --force switch on there if you donā€™t care much.

yep thatā€™s just standard stuff.

granted i havenā€™t seen that sort of code in production environments! good for prototyping though