python -i

 <l5g> After I input some command such us define a function in the python shell, i want to dump them to a new py file, so i don't need to type more, the question is "Is there a method to do it(dump)"
[160327] <verte> l5g: no.
[160329] <jorrit> Why not use copy/paste to paste what you just typed into an editor?
[160350] <Alberth> l5g: there is trickery with the inspect module, but you better start by typing Python code in a file in the first place.
[160356] <joeyjones> mzz: want to take a look at my working code?
[160433] <l5g> I remember matlab can do it.
[160438] <joeyjones> actually, i need to make some tweaks
[160442] <Alberth> Python != Matlab
[160454] <_RedGhost_> ricree: I'd match the block between {% %} and replace with a the result of a callback, personally
[160533] <l5g> Alberth I just mean python can study from matlab :-)
[160545] <-- Quits: Stormhawk (n=stormhaw@aspin.csc.warwick.ac.uk) (Remote closed the connection)
[160551] <Alberth> l5g: not really, the application domain is different
[160601] <-- Quits: ab3 (n=ab3@ip-83-134-167-7.dsl.scarlet.be) (Read error: 113 (No route to host))
[160606] <-- Parts: e6nian (i=deacec8f@gateway/web/freenode/x-kuixdagceuakapgk)
[160607] <mzz> joeyjones: why?
[160633] --> Joins: Stormhawk (n=stormhaw@aspin.csc.warwick.ac.uk)
[160722] <sentix> 15g Another way is to write your code in one file and import it to the console `import MyFile` works well
[160724] <Alberth> l5g: matlab is for interactive exploring, python is for executing code
[160728] <joeyjones> mzz: i ahev the feeling i may have borked some other stuff in it :p
[160729] <joeyjones> http://pastebin.ca/1623506
[160828] <l5g> sentix , yeah it's a good tip
[160854] <Alberth> l5g: just consider the interactive shell for quick and dirty experimenting, and use an editor for all other cases.
[160857] <sentix> 15g: One cautionary note,  if the file imports other files... If I remember correctly, a re-import won't re-import those files
[160919] <bob2> l5g: go the other way
[160927] <bob2> l5g: write it in a file, then 'python -i x.py'
[160929] --> Joins: huin (n=huin@82.152.222.96-->英国)
[160932] 

0 comments: