SERVING THE QUANTITATIVE FINANCE COMMUNITY

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: Python tricks

Tell us all the commands you did to install the package.

or install the conda manager then do this from the command line (you should add conda binary path to you PATH):
conda install -c clawpack -c conda-forge clawpack

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: Python tricks

That's not the correct link. Your error arise in the pip file unpacking.py
uh! Is that a bug in Python?
What next?
No, YOU are doing something wrong.

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: Python tricks

or better: install linux.

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

That's not the correct link. Your error arise in the pip file unpacking.py
uh! Is that a bug in Python?
What next?
No, YOU are doing something wrong.
All the other packages install fine.

PyClaw requires Python 2.7 or greater and a modern Fortran 95 compiler. PyClaw is known to work with GNU gfortran 4.2 and higher and the IBM XLF compiler.

??

install linux.
You mean, like voting for Fine Gael?
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

FaridMoussaoui
Posts: 507
Joined: June 20th, 2008, 10:05 am
Location: Genève, Genf, Ginevra, Geneva

### Re: Python tricks

I told you yesterday: Install cygwin and you will have a linux like command line. Then GNU fortran compiler.

PS1: Everyone I know doing serious scientific computing uses Linux (or at least OSX).
PS2: I have no idea what does mean your voting reference.

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

From "Python in a nutshell"

"Sometimes, however, you need a deep copy .... fortunately, this need is rare, since a deep copy can take a lot of memory and time."

I don't agree

1. Many applications need deep-fried-copied object
2. Deep copy is more thread-safe than shallow copy.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

"There are less than 5% CS graduates can program in languages other than Python, R or Java. "

and 95% of that 5% are C++ programmers

?
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

bearish
Posts: 5802
Joined: February 3rd, 2011, 2:19 pm

### Re: Python tricks

There are fewer than...

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

hinterland
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

tagoma
Topic Author
Posts: 18379
Joined: February 21st, 2010, 12:58 pm

### Re: Python tricks

hello everyone,

i'm looking into google's haiku project. they explain "Haiku is a simple neural network library for JAX developed by some of the authors of Sonnet, a neural network library for Tensorlow."

I have some sense of what Sonnet is. Now, JAX is described "JAX is Autograd and XLA, brought together for high-performance machine learning research.". So, it looks like we're in the realm of Python.

But, there is syntax that I'm not used to (as Python consumer) e.g. in this piece of code:

def make_network() -> hk.RNNCore:
"""Defines the network architecture."""
model = hk.DeepRNN([
lambda x: jax.nn.one_hot(x, num_classes=dataset.NUM_CHARS),
hk.LSTM(FLAGS.hidden_size),
jax.nn.relu,
hk.LSTM(FLAGS.hidden_size),
hk.nets.MLP([FLAGS.hidden_size, dataset.NUM_CHARS]),
])
return model

Can you please explain what is the -> and/or provide me with keywords so that I google for them?

Making sure I'll get some reactions: this makes me think to some years ago when people started to write auto main(int argc, char *argv []) -> int {} in C++

Usual disclaimers apply: I'm French, my question may be dumb, etc...

Merci.

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

Bonsoir, Monsieur tags

It looks like explicitly giving the return type (Python 3.8.3?) just as in C++ lambda functions?

https://docs.python.org/3/library/typing.html

Looks important, anything that promotes robustness.

My take is you put your type annotations in code and use 3rd party type checkers. Can't be bad.

Buona serata.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

tagoma
Topic Author
Posts: 18379
Joined: February 21st, 2010, 12:58 pm

### Re: Python tricks

Bonsoir, Monsieur tags

It looks like explicitly giving the return type (Python 3.8.3?) just as in C++ lambda functions?

https://docs.python.org/3/library/typing.html

Looks important, anything that promotes robustness.
Bonsoir Cuch. Tout va bien?
Thank you very much indeed. I wasn't aware of this strong typing syntax (really never came across such things before last night..). I'm reading further about it now.
I'm not always against tighter conventions!

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

I like lockdowns in life, code and judo
tout bien, merci!
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl

ISayMoo
Posts: 2366
Joined: September 30th, 2015, 8:30 pm

### Re: Python tricks

This is a great tool for exposing C++ code to Python: https://github.com/pybind/pybind11

Cuchulainn
Posts: 62928
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

### Re: Python tricks

This is a great tool for exposing C++ code to Python: https://github.com/pybind/pybind11
Yep.
I recommend this for my 2020 MSc students.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl