Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (26 sloc) 1.06 KB

Imports

--i/--import is a shortcut to easily import external libraries.

Importing a module

The equivalent of import xyz is --import xyz. It is equivalent to --begin import xyz, just shorter. You can use -i xyz which is even shorter.

py1 --begin 'import math' 'P(math.cos(math.pi))'
py1 --import 'math' 'P(math.cos(math.pi))'
py1 -i 'math' 'P(math.cos(math.pi))'

Importing specific symbols

The equivalent of from xyz import abc is --import xyz/abc. You can import multiple functions with --import xyz/abc,def. Something like -i xyz/* is equivalent to from xyz import *.

py1 --import 'math/cos,pi' 'P(cos(pi))'
py1 -i 'math/*' 'P(cos(pi))'

Importing with a specific name

The equivalent of import abc as ABC is --import abc:ABC. You can rename specific symbols in the same way like --import xyz/abc:ABC.

py1 --import 'math:M' 'P(M.cos(M.pi))'
You can’t perform that action at this time.