Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-23 Thread steve

On 10/23/2009 12:48 PM, Noufal Ibrahim wrote:

On Fri, Oct 23, 2009 at 12:41 PM, steve  wrote:
[..]

 Of course all this also comes built-in with the Ipython environment, but I
 never really got hooked on to that.

[..]

Do you have any reasons why? It's praised a lot in some circles but I
got a lot of negative comments about it on the #python channel.


Well, for me, there aren't any strong negative reasons really. I just felt that 
the interface was a bit 'clunky' (the extraneous use of spaces and newlines 
makes me nervous), the commands/shortcuts were non-intuitive to me and I just 
don't like reading docs before trying out something -- which I think is required 
for using ipython.


However, i still do recommend it to people who want colors, completion and all 
sorts of customization abilities from their prompt.


cheers,
- steve
--
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-23 Thread Noufal Ibrahim
On Fri, Oct 23, 2009 at 12:41 PM, steve  wrote:
[..]
> Of course all this also comes built-in with the Ipython environment, but I
> never really got hooked on to that.
[..]

Do you have any reasons why? It's praised a lot in some circles but I
got a lot of negative comments about it on the #python channel.
I personally don't use it unless I'm teaching the language since it's
perceptibly slower to start up when your python installation is on
NFS.

-- 
~noufal
http://nibrahim.net.in
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-23 Thread steve

On 10/22/2009 07:41 PM, Noufal Ibrahim wrote:

On Thu, Oct 22, 2009 at 6:43 PM, Amit Saha  wrote:

 Hello:

 I have been using CPython as a calculator, while I do all those number
 crunching in C. SO, 'import math' is a must.

 This is what I did:

 - Create a file: .pythonrc in my $HOME and place this line:


There are other goodies you can put there as well. I used to have

import readline
readline.parse_and_bind("tab: complete")

in there so that the default interpreter would get tab completion.


I also have this is my .pythonrc:

import os
import readline
histfile = os.path.join(os.environ["HOME"], ".pyhist")
try:
readline.read_history_file(histfile)
except IOError:
pass
import atexit
atexit.register(readline.write_history_file, histfile)
del os, histfile

This lets you save the history of every thing you type in your interpreter 
session much like the bash history functionality. This is immensely useful when 
I am trying out stuff on the prompt before creating a script.


Of course all this also comes built-in with the Ipython environment, but I never 
really got hooked on to that.


Anyways, besides the tip, I'd also like to point out to the 'atexit' module 
which the above tip uses. It is included in the stdlib and can prove to be quite 
useful at times. That one is good to know about.


cheers,
- steve
--
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-22 Thread Anil

Noufal Ibrahim wrote:

On Thu, Oct 22, 2009 at 7:46 PM, Anil  wrote:
  

Noufal Ibrahim wrote:


There are other goodies you can put there as well. I used to have

import readline
readline.parse_and_bind("tab: complete")

in there so that the default interpreter would get tab completion.
  

Neat !! :)
btw does Ubuntu come with readline by default??



I'm not sure what you mean by "with readline" but the readline module
is as far as I know part of the Python standard library.

I meant readline development module. anyways turns out it doesn't ...
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-22 Thread Noufal Ibrahim
On Thu, Oct 22, 2009 at 7:46 PM, Anil  wrote:
> Noufal Ibrahim wrote:
>>
>> There are other goodies you can put there as well. I used to have
>>
>> import readline
>> readline.parse_and_bind("tab: complete")
>>
>> in there so that the default interpreter would get tab completion.
>
> Neat !! :)
> btw does Ubuntu come with readline by default??

I'm not sure what you mean by "with readline" but the readline module
is as far as I know part of the Python standard library.

-- 
~noufal
http://nibrahim.net.in
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-22 Thread Anil

Noufal Ibrahim wrote:


There are other goodies you can put there as well. I used to have

import readline
readline.parse_and_bind("tab: complete")

in there so that the default interpreter would get tab completion.

Neat !! :)
btw does Ubuntu come with readline by default??

Anil
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-22 Thread Noufal Ibrahim
On Thu, Oct 22, 2009 at 6:43 PM, Amit Saha  wrote:
> Hello:
>
> I have been using CPython as a calculator, while I do all those number
> crunching in C. SO, 'import math' is a must.
>
> This is what I did:
>
> - Create a file: .pythonrc in my $HOME and place this line:

There are other goodies you can put there as well. I used to have

import readline
readline.parse_and_bind("tab: complete")

in there so that the default interpreter would get tab completion.


-- 
~noufal
http://nibrahim.net.in
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-22 Thread Amit Saha

Roshan Mathews wrote:

On Thu, Oct 22, 2009 at 6:43 PM, Amit Saha  wrote:

- Create a file: .pythonrc in my $HOME and place this line:


Thanks for the tip.  I don't use this myself, but I had read this in
Peter Norvig's Python IAQ, which makes interesting reading.  It's
available online at http://norvig.com/python-iaq.html


Nice. Thanks for sharing.



Do let on if you find anything else particularly useful. :)


With oodles of pleasure.

-Amit


Roshan Mathews




--
Journal: http://amitksaha.wordpress.com
ยต-blog: http://twitter.com/amitsaha
IRC: cornucopic on #scheme, #lisp, #math, #linux
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers


Re: [BangPypers] 2-cent Tip: Load modules at Startup

2009-10-22 Thread Roshan Mathews
On Thu, Oct 22, 2009 at 6:43 PM, Amit Saha  wrote:
> - Create a file: .pythonrc in my $HOME and place this line:
>
Thanks for the tip.  I don't use this myself, but I had read this in
Peter Norvig's Python IAQ, which makes interesting reading.  It's
available online at http://norvig.com/python-iaq.html

Do let on if you find anything else particularly useful. :)

Roshan Mathews
___
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers