Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A few questions

2 views
Skip to first unread message

jay

unread,
May 20, 2007, 11:52:03 PM5/20/07
to pytho...@python.org
Hi,

I'm totally new to Python and was hoping someone might be able to
answer a few questions for me:

1. What are your views about Python vs Perl? Do you see one as
better than the other?

2. Is there a good book to start with while learning Python? I'm
currently reading 'Python Essential Reference' by David M. Beazley.
So far it looks like a pretty good book, but would like more
tutorials to work with (I've also been reading through the tutorials
at 'python.org' which has some excellent stuff!).

3. Currently, I write most of my code with Xcode (on the Mac
platform) using Applescript. This gives me GUI capabilities. Is
there anything you'd recommend that I could use for Python that would
give me a GUI interface? I'd like this to be able to work for both
the Mac and Windows platforms. I've been reading a little about
'Claro Graphics Toolkit' and 'PyGUI'... would you recommend either of
those? I'll be writing code on a Mac so I need something that will
run on that system.

Thanks for looking at my questions.

Jay

Anthony Irwin

unread,
May 21, 2007, 12:37:33 AM5/21/07
to
jay wrote:
> Hi,
>
> I'm totally new to Python and was hoping someone might be able to answer
> a few questions for me:
>
> 1. What are your views about Python vs Perl? Do you see one as better
> than the other?

I have written some scripts in both perl and python and to me python
feels more like a modern programming language then perl does.

As I am learning both languages I can also say that I was writing
useful python code as I was learning python but had to do more reading
with perl to write similar levels of code but maybe thats just me.

>
> 3. Currently, I write most of my code with Xcode (on the Mac platform)
> using Applescript. This gives me GUI capabilities. Is there anything
> you'd recommend that I could use for Python that would give me a GUI
> interface? I'd like this to be able to work for both the Mac and
> Windows platforms. I've been reading a little about 'Claro Graphics
> Toolkit' and 'PyGUI'... would you recommend either of those? I'll be
> writing code on a Mac so I need something that will run on that system.

I have used wxpython and did the tutorial listed in their wiki and ran
it on linux and mac and they looked like native applications in both
and the same is meant to happen in windows but I don't have windows so
have not tried it myself.

To do this on the mac I installed the universal python 2.4 from the
python site and the wxpython mac install and just double clicked a
python file with a .pyw and it executed like a normal app. Originally
I had a .py file extension but that does not execute the python script.

--
Kind Regards,
Anthony Irwin

http://www.irwinresources.com
http://www.makehomebusiness.com
email: anthony at above domains, - www.

Alex Martelli

unread,
May 21, 2007, 1:20:17 AM5/21/07
to
jay <jyou...@kc.rr.com> wrote:

> Hi,
>
> I'm totally new to Python and was hoping someone might be able to
> answer a few questions for me:
>
> 1. What are your views about Python vs Perl? Do you see one as
> better than the other?

Yep: if I didn't find Python more readable, maintainable and
understandable, I obviously wouldn't have switched.


> 2. Is there a good book to start with while learning Python? I'm
> currently reading 'Python Essential Reference' by David M. Beazley.
> So far it looks like a pretty good book, but would like more
> tutorials to work with (I've also been reading through the tutorials
> at 'python.org' which has some excellent stuff!).

Beazley's excellent book, like my direct competitor "Python in a
Nutshell", is mostly meant as a _reference_, not as a tutorial. There
are many "starters' books": try "Dive into Python" (has the advantage
that you can try it for free online, just web search for it), or "Python
for Dummies", "Learning Python", "Core Python", and many more.


> 3. Currently, I write most of my code with Xcode (on the Mac
> platform) using Applescript. This gives me GUI capabilities. Is
> there anything you'd recommend that I could use for Python that would
> give me a GUI interface? I'd like this to be able to work for both
> the Mac and Windows platforms. I've been reading a little about
> 'Claro Graphics Toolkit' and 'PyGUI'... would you recommend either of
> those? I'll be writing code on a Mac so I need something that will
> run on that system.

If you wanted to work with exactly the same wonderful GUI Applescript
gives you, you should try PyObjC and use it with your Mac's Cocoa...
however, that doesn't work well on Windows. QT4 with PyQt 4 (with Eric4
as the IDE) is probably the best approach today for such cross-platform
work (haven't tried it yet, but I can vouch for the previous releases --
Qt3, PyQt 3, Eric3). Most popular, however, is no doubt wxWindows --
mostly because you can freely use it to develop SW which you plan to
distribute under closed-source licenses, while Qt &c force you to choose
-- either pay, or, if you even distribute your code, it will have to be
under the GPL. I'm not sure how well wxWindows works on Mac nowadays,
though -- I'm sure somebody else will be able to tell you. For me
personally, nowadays, it's Cocoa for Mac-only apps, while any
non-Mac-only apps I write as web-apps instead.


Alex

John Nagle

unread,
May 21, 2007, 2:16:24 AM5/21/07
to
jay wrote:
> Hi,
>
> I'm totally new to Python and was hoping someone might be able to
> answer a few questions for me:
>
> 1. What are your views about Python vs Perl? Do you see one as better
> than the other?

Python is a much cleaner language than Perl, but not as widely used.
The Python language is in good shape; the libraries vary in quality.

> 2. Is there a good book to start with while learning Python? I'm
> currently reading 'Python Essential Reference' by David M. Beazley. So
> far it looks like a pretty good book, but would like more tutorials to
> work with (I've also been reading through the tutorials at 'python.org'
> which has some excellent stuff!).

They're all reasonably good. Python doesn't have Perl's "There's
more than one way to do it" problem, so all Python books describe
the same language. (Perl books tend to describe the subsections of
the language that particular author likes. It takes about three
different Perl books to cover every language feature.) "Learning
Python" has more tutorials, but the online tutorials at "python.org"
should be sufficient. This just isn't a very difficult language.

If you have a computer science background, here's all you need
to know: Python is a byte-code interpreted untyped procedural dynamic
language with implicit declaration. Syntax is vaguely C-like. Block
structure is determined by indentation. Objects use a class definition/
explicit instantiation/multiple inheritance model. Memory management
is safe and managed by reference counts backed by a garbage collector.
Weak references are supported. Built in data types are numerics, ASCII
and Unicode strings, dynamic arrays, fixed size tuples, and hashes.
Implementation speed is typically 2% of C. That's Python.


>
> 3. Currently, I write most of my code with Xcode (on the Mac platform)
> using Applescript.

Can't speak to Mac issues. Tkinter will work, although it may be
aesthetically displeasing to Mac users.

John Nagle

brad

unread,
May 21, 2007, 11:43:07 AM5/21/07
to
Alex Martelli wrote:

> Most popular, however, is no doubt wxWindows --
> mostly because you can freely use it to develop SW which you plan to
> distribute under closed-source licenses, while Qt &c force you to choose
> -- either pay, or, if you even distribute your code, it will have to be

> under the GPL. I'm not sure how well wxWindows works on Mac nowadays...

wx Works great on Macs (10.4 at least, maybe others), Linux and Windows.
We've used it for several cross-platform apps that needed GUIs.

Christopher Arndt

unread,
May 21, 2007, 1:35:39 PM5/21/07
to
I have a few quibles with your summary of Python's properties:

On 21 Mai, 08:16, John Nagle <n...@animats.com> wrote:
> If you have a computer science background, here's all you need
> to know: Python is a byte-code interpreted untyped

Python is strongly but dynamically typed. The fact that you don't have
to declare which type a variable is, doesn't mean it's untyped.

> procedural

In Python you can programm in imperative/procedural, object-oriented
and functional style. It can thus be called a multi-paradigm language.
IMO it is best suited for the object-oriented paradigm.

> dynamic language with implicit declaration. Syntax is vaguely C-like.

It shares many syntax rules with C (variable names, literals,
functions, ...) but it doesn't look at all like C (no braces,
semicolons, assignment expressions, pointers, ...).

> Block structure is determined by indentation. Objects use a class definition/
> explicit instantiation/multiple inheritance model.

Most important, classes are defined at run-time, not compile time,
which makes them highly dynamic.

Furthermore, classes, functions and methods are first-class data-
types, i.e you can pass them (or more correctly, references to them)
around as arguments or assign them to variables.

> Memory management
> is safe and managed by reference counts backed by a garbage collector.
> Weak references are supported. Built in data types are numerics, ASCII
> and Unicode strings, dynamic arrays, fixed size tuples, and hashes.

Python lists are much more than arrays. More like a linked list.
You forgot sets. And functions, classes, methods, instances.... (see
above)

> Implementation speed is typically 2% of C.

Execution speed is approx. 2% - 150% of C :-)


Chris

Kevin Walzer

unread,
May 21, 2007, 1:38:22 PM5/21/07
to
jay wrote:

> 3. Currently, I write most of my code with Xcode (on the Mac platform)
> using Applescript. This gives me GUI capabilities. Is there anything
> you'd recommend that I could use for Python that would give me a GUI
> interface?

PyObjC allows you to write Cocoa GUI's from Python using Xcode and
Interface Builder, much as AppleScript Studio does. However, that's not
a cross-platform solution.

Tkinter runs on Windows as well as OS X. Out-of-the-box, however,
Tkinter is somewhat limited. To build rich GUI's with Tkinter, you will
need to install several additional Tk libraries and their associated
Python wrappers. Tkinter is my toolkit of choice, and I've released a
Python shareware application on OS X that uses it: see
http://www.codebykevin.com/phynchronicity-running.png for a screenshot.

wxPython is also a very reasonable solution, and will probably give you
more out of the box than Tkinter. My main reason for using Tk is that I
already know it well.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

Josiah Carlson

unread,
May 21, 2007, 9:22:50 PM5/21/07
to

Python lists are implemented as C arrays that are resized as necessary.

- Josiah

Basilisk96

unread,
May 21, 2007, 9:53:23 PM5/21/07
to
> 2. Is there a good book to start with while learning Python? I'm
> currently reading 'Python Essential Reference' by David M. Beazley.
> So far it looks like a pretty good book, but would like more
> tutorials to work with (I've also been reading through the tutorials
> at 'python.org' which has some excellent stuff!).

Take a walk through the text "How to Think Like a Computer Scientist":
http://www.ibiblio.org/obp/thinkCSpy/
It's medium-paced, well-organized, and - quite importantly IMHO -
builds well on knowledge acquired in the previous chapters as it
progresses. There are plenty of hands-on examples; and really, the
text was written by a high school teacher for a CS curriculum, so it's
structured more like a tutorial. I found it to be priceless when I
first got interested in Python, and I would highly recommend it to any
newbie, whether with previous programming experience or not, but who
has never laid eyes on Python before. As I think back on it, the book
gives you just enough information to make you hungry for more - and
indeed, after reading it I had enough insight to explore Python on my
own and started writing useful programs by myself.

>
> 3. Currently, I write most of my code with Xcode (on the Mac
> platform) using Applescript. This gives me GUI capabilities. Is
> there anything you'd recommend that I could use for Python that would
> give me a GUI interface? I'd like this to be able to work for both
> the Mac and Windows platforms. I've been reading a little about
> 'Claro Graphics Toolkit' and 'PyGUI'... would you recommend either of
> those? I'll be writing code on a Mac so I need something that will
> run on that system.
>

Try wxPython. I've seen it run on a Mac with OS X and Windows
simultaneously, where the operating systems were switched from one to
the other at the touch of a button, and the GUI had a very native look
in either platform (mind you, the app was running exactly the same
code in both cases!).
I write my code on a win32 box, so I have no further pointers for you
regarding a Mac.

-Basilisk96

jay

unread,
May 21, 2007, 10:33:42 PM5/21/07
to pytho...@python.org
Wow!! Thanks so much for your quick and helpful replies! I really
appreciate it!! :-)

I tried installing off 'wxPython2.8-osx-ansi-2.8.4.0-universal10.4-
py2.5.dmg' on my OS 10.4.9 system which wouldn't install. So I
installed off 'python-2.5-macosx.dmg' and then installed off
'wxPython2.8-osx-ansi-2.8.4.0-universal10.4-py2.5.dmg' which seemed
to work. I find the instructions confusing as to what to install.
After this I went to the tutorial and started trying out some of the
examples. I pasted the code to separate text files and then ran them
through a Terminal window. This stuff is freaking cool!!! Now I
just have to figure out how this all works!

Anyway, I had one more quick question... in order to run wxPython
apps, do I have to have MacPython, etc. loaded on each Mac (or PC) in
order for it to run any apps I write? Or is there a way to compile
the code to where I can distribute an app I write and the other users
don't need to load anything in order to run the app?

Thanks again for your help with all this. I really appreciate you
all taking the time to look and answer our questions.

Jay

Basilisk96

unread,
May 21, 2007, 11:11:42 PM5/21/07
to
> After this I went to the tutorial and started trying out some of the
> examples. I pasted the code to separate text files and then ran them
> through a Terminal window. This stuff is freaking cool!!! Now I
> just have to figure out how this all works!
>
"wxPython in Action" is a decent book for learning wxPython:
http://www.manning.com/rappin/

As with any GUI toolkit, there is a learning curve until you get used
to how the components work together. But there is enough hands-on
material to get started with simple GUI apps.

> Anyway, I had one more quick question... in order to run wxPython
> apps, do I have to have MacPython, etc. loaded on each Mac (or PC) in
> order for it to run any apps I write? Or is there a way to compile
> the code to where I can distribute an app I write and the other users
> don't need to load anything in order to run the app?

Again, I can't speak for Macs, but I know that for Windows there is
one package suitably called "py2exe", available from http://www.py2exe.org/
which allows you to freeze your code and distribute it to multiple
users as an executable file plus some extra baggage files containing
bytecode and necessary DLL's, including the Python interpreter itself.
This way, the end user does not need to install Python, wxPython, or
any other Python libraries used by your project, nor does the end user
even need to know anything about Python. Pros? The app is ready to run
as shipped. Cons? Relatively large size of the distributable package -
a typical simple GUI app is 6MB+ when packaged this way. Although...
with the acres of storage space available on today's media, this is
hardly a problem. :)

Kevin Walzer

unread,
May 21, 2007, 11:41:58 PM5/21/07
to
jay wrote:

>
> Anyway, I had one more quick question... in order to run wxPython apps,
> do I have to have MacPython, etc. loaded on each Mac (or PC) in order
> for it to run any apps I write? Or is there a way to compile the code
> to where I can distribute an app I write and the other users don't need
> to load anything in order to run the app?

Google for "py2app." It's the standard tool for distributing standalone
Python apps on OS X.

Kevin Walzer

unread,
May 21, 2007, 11:41:58 PM5/21/07
to jay, pytho...@python.org
jay wrote:

>
> Anyway, I had one more quick question... in order to run wxPython apps,
> do I have to have MacPython, etc. loaded on each Mac (or PC) in order
> for it to run any apps I write? Or is there a way to compile the code
> to where I can distribute an app I write and the other users don't need
> to load anything in order to run the app?

Google for "py2app." It's the standard tool for distributing standalone

Dave Baum

unread,
May 21, 2007, 11:46:17 AM5/21/07
to
In article <mailman.7945.1179719...@python.org>,
jay <jyou...@kc.rr.com> wrote:

> Hi,
>
> I'm totally new to Python and was hoping someone might be able to
> answer a few questions for me:
>
> 1. What are your views about Python vs Perl? Do you see one as
> better than the other?

I introduced Python into my group at work and it has for the most part
supplanted Perl. For short scripts Python tends to be a lot more
readable than Perl. Python also scales better, allowing us to tackle
some larger projects with Python than we would have attempted with Perl.

However, a lot of this depends on your current skill with the languages
and the kind of project you will be working on. A Perl guru is going to
be more productive with Perl than with Python. Text processing programs
are likely to be more concise in Perl than Python. However, as a
general purpose programming language I think Python is an excellent
choice.

> 2. Is there a good book to start with while learning Python? I'm
> currently reading 'Python Essential Reference' by David M. Beazley.
> So far it looks like a pretty good book, but would like more
> tutorials to work with (I've also been reading through the tutorials
> at 'python.org' which has some excellent stuff!).

"Learning Python" is a good book for getting started, although it is a
bit dated by now. It might not be quite what you are looking for with
respect to tutorials, so I'd recommend looking at a copy before buying
it.

> 3. Currently, I write most of my code with Xcode (on the Mac
> platform) using Applescript. This gives me GUI capabilities. Is
> there anything you'd recommend that I could use for Python that would
> give me a GUI interface? I'd like this to be able to work for both
> the Mac and Windows platforms. I've been reading a little about
> 'Claro Graphics Toolkit' and 'PyGUI'... would you recommend either of
> those? I'll be writing code on a Mac so I need something that will
> run on that system.

Tkinter is the easiest way to get started with Python GUI programming
because it is part of the default python distribution. However, I
prefer wxPython for GUI development. You'll have to install a few extra
pieces, but in the end wxPython does a better job of being "pythonic"
for the programmer, and resulting in native look and feel for the user.
"wxPython in Action" is an excellent book for learning about wxPython.


Dave

JYOU...@kc.rr.com

unread,
May 24, 2007, 9:08:38 AM5/24/07
to pytho...@python.org
Just wanted to send a quick "Thank You!" to everyone who helped answer my questions. This
list is awesome!!

I'm currently reading "How to Think Like a Computer Scientist" (thanks Basilisk96) and it's got
some excellent
tutorial info. I still want to take a look at "Dive into Python" as well as the other books you all
mentioned. I'll
continue working with wxPython and py2app too... these are some cool apps!!

Again, thank you all for taking the time to help me with all this. I really appreciate it!

Jay

scott

unread,
May 24, 2007, 9:48:25 AM5/24/07
to pytho...@python.org
JYOU...@kc.rr.com wrote:
> Just wanted to send a quick "Thank You!" to everyone who helped answer my questions. This
> list is awesome!!
I'm finding the same, this list is amazing. There is a more welcome
feeling than the C or C++ list I have seen.

> I'm currently reading "How to Think Like a Computer Scientist" (thanks Basilisk96)

Me too, it is an amazing book and I am loving Python much better than C.
I would just like to find some answers to the exercises to make sure
I'm doing them correctly.

> I still want to take a look at "Dive into Python" as well as the other books you all
> mentioned.

I put "Dive into Python" on my palm. Is it a good 2nd book to go through?

--
Your friend,
Scott

Sent to you from a Linux computer using Kubuntu Version 7.04 (Feisty Fawn)

0 new messages