Re: [Tutor] Best Python Editor

2009-06-14 Thread Lie Ryan
Michael Powe wrote:

> It's good to see so much common sense prevailing on this topic.  

It's good that this newsgroup is not as prevalent to being flamed. In
certain other newsgroup, even (an honest and naive) mentioning of
preferred editor would turn the thread into World War E.

> An
> IDE such as eclipse or VS really only becomes a necessity for
> productivity when (a) you are dealing with multiple code files and
> proper compilation and linking and so forth becomes complicated; or

People that write in text editors often uses makefiles to handle that.
However, in python, there is nothing much to be done with multiple file
handling. Python's import mechanism just works like magic...

> Most often, simply the ability to jump to the error line is provided
> and I suppose that must be generally acceptable.

vim does.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Michael Powe
On Sun, Jun 14, 2009 at 12:53:19PM -0700, Emile van Sebille wrote:

> On 6/14/2009 8:04 AM Alan Gauld said...
> >"Tom Green"  wrote

> >>Since VIM seems to be the editor of choice and I have been programming in
> >>Python for many years using Pyscripter and Eclipse I was wondering how I
> >>could transition away from the IDE world to VIM.

> >With great difficulty and to be honest I wouyldn't bother.
> >If you are used to eclipse then there is little to be gained from moving 
> >to vim.

> Seconded.  Editors are a personal choice and often the loss of 
> productivity while learning a new environment isn't worth it.  My 
> introduction to coding Turbo Pascal was eased owing to the WordStar 
> compatible/modeled editor it used.  Nowadays, any editor with 
> configurable syntax capability is sufficient.  It's all personal 
> preference after that.

It's good to see so much common sense prevailing on this topic.  An
IDE such as eclipse or VS really only becomes a necessity for
productivity when (a) you are dealing with multiple code files and
proper compilation and linking and so forth becomes complicated; or
(b) you are working in a language with which you are not as familiar
as you should like to be, and autocompletion because a real asset.

However, I will say that while following this thread, it occurred to
me that the one feature that VS and even the VBA editor in MS Office
has, is the ability to pop you into the debugger on error.  This
feature is so useful that it surprises me nobody else seems to do it.
Most often, simply the ability to jump to the error line is provided
and I suppose that must be generally acceptable.

Thanks.

mp
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Emile van Sebille

On 6/14/2009 8:04 AM Alan Gauld said...

"Tom Green"  wrote


Since VIM seems to be the editor of choice and I have been programming in
Python for many years using Pyscripter and Eclipse I was wondering how I
could transition away from the IDE world to VIM.


With great difficulty and to be honest I wouyldn't bother.
If you are used to eclipse then there is little to be gained from moving 
to vim.


Seconded.  Editors are a personal choice and often the loss of 
productivity while learning a new environment isn't worth it.  My 
introduction to coding Turbo Pascal was eased owing to the WordStar 
compatible/modeled editor it used.  Nowadays, any editor with 
configurable syntax capability is sufficient.  It's all personal 
preference after that.





Some of this might just be what we are used to too. Remember that
IDEs as such didn't really come into existence till about 12-15 years
ago. Those of us who have notched up more than 2 or 3 decades of
coding have probably just not got used to the new concepts yet!


Full screen editing with WordStar spoiled me after having only the 
primitive form of edlin I'd been working with.  vi on the *nix boxen was 
(and still is) a necessary tool because it was/is available everywhere, 
but I never quite got it and only cautiously use it when I do. 
Somewhere along the line I heard that "vi has two modes -- one that 
beeps at you; and another that destroys your file."  Since then I've had 
fewer problems with it.  :)


My editor for the past ten years or so has been TextPad on windows with 
a variety of syntax plugins. (php,perl,python,pro5,postscript)


Emile

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Kurt Bendl
I've been pretty happy with WingIDE from wingware and have been  
impressed with the give-away version of Komodo from ActiveState. My  
fall back editor when I'm in a hurry on mac is still TextMate.
Knowing my way around vim is essential, but I just can't commit to it  
as my primary editor.  (I guess I'm just not hard core enough.) I like  
Kate on Ubuntu as well.



Kurt

--
http://tool.net



On Jun 14, 2009, at 12:26 PM, Carlos Zuniga   
wrote:



On Sat, Jun 13, 2009 at 7:57 PM, Wayne wrote:

On Sat, Jun 13, 2009 at 7:40 PM, Mike Hoy  wrote:


Try out Vim. It may take you a week to get used to it. Best thing  
I ever
did was finally get started on Vim. Once I got used to it I was  
very happy.
Google around for Vim tutorials. There is a #VIM channel on  
freenode I
believe. There is also a VIM mailing list that is very helpful.  
You won't
need these for long. Once you get used to it and think you've  
learned all

you can you find out there's even more stuff you can do with it.


So it's something that you use for life once you get that feeling of
enlightenment that comes from never having to remove your hands  
from the

keyboard.


I'm another viim fanatic;

I use two terminals - one with vim and one with ipython (I write  
most of my
code on linux). When I'm on windows I have a cmd window open with  
Ipython
and I have a gVim window open. I'm sure I barely scratch the  
surface of
things I can do and I know I've stopped using some things that I'm  
sure I'll

start using the more I code.

I really like using F5 to run my code, so you can put in  
your .vimrc so you

don't have to type it, or just type it every time:

map  :!python %

and every time you hit  it will run your current script.

Of course I also write code in c++ for school, so I have a few  
different

keys that will change the F5 bindings.


You can map it directly to the filename extension so it uses the
correct bindings automatically

au BufNewFile,BufRead *.py map  :!python %

Cheers

--
Linux Registered User # 386081
A menudo unas pocas horas de "Prueba y error" podrán ahorrarte minut 
os

de leer manuales.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Alan Gauld


"Alan Gauld"  wrote 


[ And of course Smalltalk80 had a very complete IDE in 1980,
(See Squeek screenshots for  some idea of how it differs from 
modern GUIs!) but  Smalltalk has always been an exception to 
the rules! ]


I'm not doing well today.
Since I last looked Squeak has obviously changed course big style!
It was originally trying to recreate the original parcPlace Smalltalk80 
environment but the latest screenshots are something altogether 
more modern looking.


Once more I apologise.

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Carlos Zuniga
On Sat, Jun 13, 2009 at 7:57 PM, Wayne wrote:
> On Sat, Jun 13, 2009 at 7:40 PM, Mike Hoy  wrote:
>>
>> Try out Vim. It may take you a week to get used to it. Best thing I ever
>> did was finally get started on Vim. Once I got used to it I was very happy.
>> Google around for Vim tutorials. There is a #VIM channel on freenode I
>> believe. There is also a VIM mailing list that is very helpful. You won't
>> need these for long. Once you get used to it and think you've learned all
>> you can you find out there's even more stuff you can do with it.
>> 
>>
>> So it's something that you use for life once you get that feeling of
>> enlightenment that comes from never having to remove your hands from the
>> keyboard.
>
> I'm another viim fanatic;
>
> I use two terminals - one with vim and one with ipython (I write most of my
> code on linux). When I'm on windows I have a cmd window open with Ipython
> and I have a gVim window open. I'm sure I barely scratch the surface of
> things I can do and I know I've stopped using some things that I'm sure I'll
> start using the more I code.
>
> I really like using F5 to run my code, so you can put in your .vimrc so you
> don't have to type it, or just type it every time:
>
> map  :!python %
>
> and every time you hit  it will run your current script.
>
> Of course I also write code in c++ for school, so I have a few different
> keys that will change the F5 bindings.

You can map it directly to the filename extension so it uses the
correct bindings automatically

au BufNewFile,BufRead *.py map  :!python %

Cheers

-- 
Linux Registered User # 386081
A menudo unas pocas horas de "Prueba y error" podrán ahorrarte minutos
de leer manuales.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Alan Gauld

"Alan Gauld"  wrote


Some of this might just be what we are used to too. Remember that
IDEs as such didn't really come into existence till about 12-15 years


Sigh! I'm getting old

In fact the first thing I would call an IDE in the modern sense was 
probably Turbo Pascal v4 (previous versions didn't include a 
debugger) which came out in 1987 according to Wikipedia. 
So in fact IDEs have been around on PCs for about 22 years! 
But they certainly weren't common on *nix until about the 
mid 90's (Galaxy, Object/CodeCenter and HP Softbench 
being very expensive exceptions!)


[ And of course Smalltalk80 had a very complete IDE in 1980,
(See Squeek screenshots for  some idea of how it differs from 
modern GUIs!) but  Smalltalk has always been an exception to 
the rules! ]


Apologies for the misinformation.

Alan G

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Discussion of super

2009-06-14 Thread Skipper Seabold
Hello all,

I am working under the umbrella of the Python Software Foundation for
the Google Summer of Code and am keeping a blog about the work.  Part
of my work is refactoring and extending some existing code.  This code
makes use of Python's super, and so I am trying to understand the ins
and outs of super.  I recently summarized my understanding of super on
my blog, and I was wondering if anyone would care to comment on my
write up.  I am particularly worried about my handling of my multiple
inheritance example and explanation of class F.

I apologize for the length and if this is an inappropriate request for
this list, but I read the discussions here almost daily, and often the
points that come up add to my Python understanding very much.
Everyone seems to have a great grasp of Python and programming and
that rare ability (and willingness) to *explain* topics.

The post is here


But if it's easier for the ML, comments can be inlined below.  The
In/Out prompts are the iPython interpreter if anyone is wondering, and
I tried to preserve indents.

Cheers,

Skipper

--

The current statistical models package is housed in the NiPy,
Neuroimaging in Python, project. Right now, it is designed to rely on
Python's built-in super to handle class inheritance. This post will
dig a little more into the super function and what it means for the
design of the project and future extensions. Note that there are
plenty of good places to learn about super and that this post is to
help me as much as anyone else. You can find the documentation for
super here. If this is a bit confusing, it will, I hope, become
clearer after I demonstrate the usage.

First, let's take a look at how super actually works for the simple
case of single inheritance (right now, we are not planning on using
multiple inheritance in the project) and an __init__ chain (note that
super can call any of its parent class's methods, but using __init__
is my current use case).

The following examples were adapted from some code provided by mentors
(thank you!).

class A(object):
def __init__(self, a):
self.a = a
print 'executing A().__init__'

class B(A):
def __init__(self, a):
self.ab = a*2
print 'executing B().__init__'
super(B,self).__init__(a)

class C(B):
def __init__(self, a):
self.ac = a*3
print 'executing C().__init__'
super(C,self).__init__(a)

Now let's have a look at creating an instance of C.

In [2]: cinst = C(10)
executing C().__init__
executing B().__init__
executing A().__init__

In [3]: vars(cinst)
Out[3]: {'a': 10, 'ab': 20, 'ac': 30}

That seems simple enough. Creating an instance of C with a = 10 will
also give C the attributes of B(10) and A(10). This means our one
instance of C has three attributes: cinst.ac, cinst.ab, cinst.a. The
latter two were created by its parent classes (or superclasses)
__init__ method. Note that A is also a new-style class. It subclasses
the 'object' type.

The actual calls to super pass the generic class 'C' and a handle to
that class 'self', which is 'cinst' in our case. Super returns the
literal parent of the class instance C since we passed it 'self'. It
should be noted that A and B were created when we initialized cinst
and are, therefore, 'bound' class objects (bound to cinst in memory
through the actual instance of class C) and not referring to the class
A and class B instructions defined at the interpreter (assuming you
are typing along at the interpreter).

Okay now let's define a few more classes to look briefly at multiple
inheritance.

class D(A):
def __init__(self, a):
self.ad = a*4
print 'executing D().__init__'
# if super is commented out then __init__ chain ends
#super(D,self).__init__(a)

class E(D):
def __init__(self, a):
self.ae = a*5
print 'executing E().__init__'
super(E,self).__init__(a)

Note that the call to super in D is commented out. This breaks the
__init__ chain.

In [4]: einst = E(10)
executing E().__init__
executing D().__init__

In [5]: vars(einst)
Out[5]: {'ad': 40, 'ae': 50}

If we uncomment the super in D, we get as we would expect

In [6]: einst = E(10)
executing E().__init__
executing D().__init__
executing A().__init__

In [7]: vars(einst)
Out[7]: {'a': 10, 'ad': 40, 'ae': 50}

Ok that's pretty straightforward. In this way super is used to pass
off something to its parent class. For instance, say we have a little
more realistic example and the instance of C takes some timeseries
data that exhibits serial correlation. Then we can have C correct for
the covariance structure of the data and "pass it up" to B where B can
then perform OLS on our data now that it meets the assumptions of OLS.
Further B can pass this data to A and return some descriptive
st

Re: [Tutor] Best Python Editor

2009-06-14 Thread Alan Gauld

"Tom Green"  wrote


Since VIM seems to be the editor of choice and I have been programming in
Python for many years using Pyscripter and Eclipse I was wondering how I
could transition away from the IDE world to VIM.


With great difficulty and to be honest I wouyldn't bother.
If you are used to eclipse then there is little to be gained from moving to 
vim.

vim is a more powerful and faster editor once you know it, but learning
it takes a while. But the "Microsoft IDE" v the "Unix style" of programming
are fundamentally different paradigms and if you are already comfortable
with an IDE I'd stick with that style. Particul;arly with Eclipse which is 
cross

platform and therefore available on most OS.



My main issue is how do I go about using VIM to debug my code?


You set up a key mapping to either start the Python debugger or one
of the GUI variants such as winpdb. To be honest the great thing about
Python is you hardly ever need a debugger, especially if you are
programming interactively using the >>> prompt (or IPython etc)


have the ability to see the variable values etc.


Get to know the introspection capabilities of Python, dir() help() etc

Pyscripter when calling a function a nice balloon hint appears showing 
you

the number of parameters and their types.


Tooltip help is the biggest single reason for using an IDE. It is genuinely
useful and not available on any straight editor I know of. However if you
are using a >>> prompt you can type help() to get the same info, but
it is slower. But if you are familiar with Python and its libraries its not
needed all that often. (And some people do get irritated by tooltips,
I used to in Delphi when I was an expert and I turned them off but now,
as an occasional programmer I do find them helpful)

don't know off hand the values.  Maybe someone could share how they go 
about

programming a good size program with VIM as I would like to use it.


You program the modules in small chunks. You design the structure
of the program and build it bottom up. And I use the >>> prompt for ad-hoc
testing and experimentation a lot. I bounce between the OS shell (to
execute the program(*), the Python shell to try out code ideas, and
the editor.

(*) Some prefer to run the code from inside the editor but I find that
loses the output which is often what I want to see so I use a separate
OS window. That also means there is no strange environmental
stuff altering the behaviour.

get me wrong for quick programs I will use VIM or notepad, but when it 
comes
to building a OOP program I find Eclipse or Pyscripter much easier to 
use.


See I'm the opposite, I use Pythonwin or Eclipse for building small
programs but bigger things with multiple modukles I go for vim or Scite.
PyScripter looks like it might just win me over if I persevere, pity I 
can't

get the debugger to work at all...

Some of this might just be what we are used to too. Remember that
IDEs as such didn't really come into existence till about 12-15 years
ago. Those of us who have notched up more than 2 or 3 decades of
coding have probably just not got used to the new concepts yet!
Unix was the original IDE! :-)

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/ 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Wayne
On Sun, Jun 14, 2009 at 5:55 AM, Tom Green  wrote:

> Since VIM seems to be the editor of choice and I have been programming in
> Python for many years using Pyscripter and Eclipse I was wondering how I
> could transition away from the IDE world to VIM.  My main issue is how do I
> go about using VIM to debug my code?


I usually use print statements and/or raw_input's if you want break points.


> With Pyscripter and other IDES its as simple as placing a breakpoint and
> pressing F7 to step thru the code and you have the ability to see the
> variable values etc.


I know you can do some similar things with the python debugger but I've
honestly never used it that much (or worked on a project large enough I
needed to!)


> Also, with an IDE such as Pyscripter when calling a function a nice balloon
> hint appears showing you the number of parameters and their types.


It's not precisely the same thing, but you can fold multiple lines, which
allows you to have only the top line of a function showing. I find that
rather helpful, and ctrl-n autocompletes the function name. Then you can
mark the location with m then a-to-z (I use c as a mnemonic for 'current')
then move on top of the name and push * - that will find the next occurence
of the word, which is often the function declaration. I just hit "n" (next)
until I find it, if that's not the case. Then I type ` (the one over the
tilde) then c which takes me back to my 'current' location. If you really
wanted, though, you could also have horizontal split of the same file, and
you could probably write a macro that would move to that window/buffer and
find the function declaraition (so it would search for def ). I don't know precisely how the dropdown autocomplete menu
works but you could also probably edit your script to add parameters for the
function call just like an IDE.


>   Coming from a Visual Studio background this is great, as I might be
> calling a function or method and I don't know off hand the values.  Maybe
> someone could share how they go about programming a good size program with
> VIM as I would like to use it.  Don't get me wrong for quick programs I will
> use VIM or notepad, but when it comes to building a OOP program I find
> Eclipse or Pyscripter much easier to use.


I suppose that's probably the case for a few people - and certainly the
reason those tools exist in the first place. If I were working on a quite
large program I might consider using an IDE, but in reality I'm probably
just as comfortable jumping around code to look for the information I need
as I would be using an IDE.

HTH,
Wayne


> On Sun, Jun 14, 2009 at 12:54 AM, Eddie  wrote:
>
>> I downloaded the previous version of PyScripter although couldn't get
>> it to work and after googling it, I downloaded Python Portable 1.1
>> (Python 2.6.1 as most sites/books recommend this and not 3) which has
>> PySCripter included and this then works fine.Ii also downloaded Komod0
>> 5.1 and after messing around with these, I think I prefer PyScripter
>> and will use that for the mean time.
>>
>> I'll also take a look at VIM as being able to use the same program for
>> PHP/CSS/HTML (and Basic if it supports it) as well as hopefully Python
>> (I've only just started learning it) would be an advantage.
>>
>> Thanks guys
>> Eddie
>>
>> 2009/6/14 Mike Hoy :
>> >>
>> >>
>> >> I really like using F5 to run my code, so you can put in your .vimrc so
>> >> you don't have to type it, or just type it every time:
>> >>
>> >> map  :!python %
>> >>
>> >> and every time you hit  it will run your current script.
>> >>
>> > Thanks for that. It's even better than typing :!python % because it
>> doesn't
>> > spawn a shell separate from the Vim window.
>> >
>> > ___
>> > Tutor maillist  -  Tutor@python.org
>> > http://mail.python.org/mailman/listinfo/tutor
>> >
>> >
>> ___
>> Tutor maillist  -  Tutor@python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn’t. - Primo Levi
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread johnf
On Saturday 13 June 2009 02:44:53 am Eddie wrote:
> Hi guys,
>
> What would you regard as the best free Python editor to use on Windows
> for a new guy? Searching Google i see that there is quite a few out
> there and is "VIM" the best one to go with?
>
> Regards
> Eddie
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

Looks like no one has suggested "wing" (a free version and cost version).  
I've been using it for years - but I like ide's and it works well with 
wxpython.  Also net-beans supports python, along with eclipse.  Then there's 
eric if you like qt.  Then something called drPython (I think).   

-- 
John Fabiani
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python Editor

2009-06-14 Thread Tom Green
Since VIM seems to be the editor of choice and I have been programming in
Python for many years using Pyscripter and Eclipse I was wondering how I
could transition away from the IDE world to VIM.  My main issue is how do I
go about using VIM to debug my code?  With Pyscripter and other IDES its as
simple as placing a breakpoint and pressing F7 to step thru the code and you
have the ability to see the variable values etc.  Also, with an IDE such as
Pyscripter when calling a function a nice balloon hint appears showing you
the number of parameters and their types.  Coming from a Visual Studio
background this is great, as I might be calling a function or method and I
don't know off hand the values.  Maybe someone could share how they go about
programming a good size program with VIM as I would like to use it.  Don't
get me wrong for quick programs I will use VIM or notepad, but when it comes
to building a OOP program I find Eclipse or Pyscripter much easier to use.

Regards,
T. Green

On Sun, Jun 14, 2009 at 12:54 AM, Eddie  wrote:

> I downloaded the previous version of PyScripter although couldn't get
> it to work and after googling it, I downloaded Python Portable 1.1
> (Python 2.6.1 as most sites/books recommend this and not 3) which has
> PySCripter included and this then works fine.Ii also downloaded Komod0
> 5.1 and after messing around with these, I think I prefer PyScripter
> and will use that for the mean time.
>
> I'll also take a look at VIM as being able to use the same program for
> PHP/CSS/HTML (and Basic if it supports it) as well as hopefully Python
> (I've only just started learning it) would be an advantage.
>
> Thanks guys
> Eddie
>
> 2009/6/14 Mike Hoy :
> >>
> >>
> >> I really like using F5 to run my code, so you can put in your .vimrc so
> >> you don't have to type it, or just type it every time:
> >>
> >> map  :!python %
> >>
> >> and every time you hit  it will run your current script.
> >>
> > Thanks for that. It's even better than typing :!python % because it
> doesn't
> > spawn a shell separate from the Vim window.
> >
> > ___
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
> >
> >
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor