By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,291 Members | 3,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,291 IT Pros & Developers. It's quick & easy.

What is Python?!

P: n/a
hi

I'm learning python since 3 days. I' ve some programming experience in
BASIC, Pascal, C, C++ and Java. Actually I want to add a scripting
language to this repertoire (I have virtually no experience with
scripting).

Having read that python is object orientated, I start wondering if
python is the right choice and what it is...

a scripting language or a "normal" language like C++ etc.

So please tell me what python is, what are it's strength, what is it
good for and when should I use it and not one of the other languages.

other questions:
What about graphic? Can I create graphical interfaces with python?

Python is interpreted but is it compiled to something like the java byte
code or are there other ways to prevent the user to read my code?

further hints for learning python and recommendations on books,
tutorials, exampels, etc. are also welcome.

thanks
Aug 10 '05 #1
Share this Question
Share on Google+
16 Replies


P: n/a
Robert Wierschke ha scritto:
....
Reading the FAQ at the python website too difficult? I don't think you
missed any of the most frequently asked... Good job.

--
Adriano Varoli Piazza
The Inside Out: http://moranar.com.ar
MSN: ad*******@hotmail.com
ICQ: 4410132
Aug 10 '05 #2

P: n/a
Adriano Varoli Piazza schrieb:
Robert Wierschke ha scritto:
...
Reading the FAQ at the python website too difficult? I don't think you
missed any of the most frequently asked... Good job.


sorry I 've forgetten the FAQ
Aug 10 '05 #3

P: n/a
Robert Wierschke wrote:
Having read that python is object orientated, I start wondering if
python is the right choice and what it is...

a scripting language or a "normal" language like C++ etc.
Ignore the "scripting language" label and just treat Python as a general
purpose "normal" language like C++, Java, Ruby, and so forth. Judge a
language by what is done with it, not by the implementation details.
So please tell me what python is, what are it's strength, what is it
good for and when should I use it and not one of the other languages.
Easily findable with some web searching... Google is your friend.
Python is interpreted but is it compiled to something like the java byte
code or are there other ways to prevent the user to read my code?


The simple answer is yes, it's like Java byte code, but it's Python byte
code instead... As with any other language, relying on this to hide
your code is inadvisable and ultimately a waste of time.

-Peter
Aug 10 '05 #4

P: n/a
Robert Wierschke <wi****@gmx.de> wrote:
a scripting language or a "normal" language like C++ etc.
It is difficult to define exactly what a "scripting language" is and isn't,
but I think most people would classify it as a scripting language.
So please tell me what python is, what are it's strength, what is it
good for and when should I use it and not one of the other languages.
I think it's biggest strengths are that it's easy to learn and easy to use.

There is no separate compile stage, so testing things out is quick and
easy. The language does compile to byte code (just like Java does), but
unlike Java, the compile stage happens completely automatically. You just
run your program, and the system figures out if it needs to compile (or
re-compile) your source for you.

The ability to fire up an interactive session is key. If I'm unsure of
something, it's usually faster to just run python and try something out
(or, use the built-in help system, or use dir() to get a listing of all of
an objects methods) than to look in the manual. If your interpreter was
built properly, it's even got input editing and history built in via the
GNU readline library.
What about graphic? Can I create graphical interfaces with python?
There are several GUI libraries. I don't do that kind of work, so I'll
leave it to others to explain them.
Python is interpreted but is it compiled to something like the java byte
code or are there other ways to prevent the user to read my code?


It is exactly like Java. In fact, it's so close, there's a system called
Jython, which lets you compile Java source to Python byte code. Yes, this
means it will always be possible for users to re-create your source code
from the byte-code object files you ship. How much of an issue this is to
you is a business decision.
Aug 10 '05 #5

P: n/a
On Wed, 10 Aug 2005 13:14:26 +0200, Robert Wierschke <wi****@gmx.de> wrote:
hi

I'm learning python since 3 days. I' ve some programming experience in
BASIC, Pascal, C, C++ and Java. Actually I want to add a scripting
language to this repertoire (I have virtually no experience with
scripting).

Having read that python is object orientated, I start wondering if
python is the right choice and what it is...

a scripting language or a "normal" language like C++ etc.
Both.
So please tell me what python is, what are it's strength, what is it
good for and when should I use it and not one of the other languages.

other questions:
What about graphic? Can I create graphical interfaces with python?
There are several GUIs available, for example Tkinter.
Python is interpreted but is it compiled to something like the java byte
code


Yes. It is compiled to .pyc files which are then interpreted;
exactly the same idea that java uses.

--
Email: zen19725 at zen dot co dot uk
Aug 10 '05 #6

P: n/a
Roy Smith wrote:
Robert Wierschke <wi****@gmx.de> wrote:
a scripting language or a "normal" language like C++ etc.

It is difficult to define exactly what a "scripting language" is and isn't,


You can tell buy the most common use. bash is a scripting language,
javascript is a scripting language, perl is a scripting language, php is
a scripting language, Python is *not* a scripting language !-)
but I think most people would classify it as a scripting language.


It can be used for scripting too, yes.
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'o****@xiludom.gro'.split('@')])"
Aug 10 '05 #7

P: n/a
Roy Smith wrote: "there's a system called Jython, which lets you
compile Java source to Python byte code."

Don't you have that the wrong way 'round? From the Jython website:
"Jython is an implementation of the high-level, dynamic,
object-oriented language Python written in 100% Pure Java, and
seamlessly integrated with the Java platform. It thus allows you to run
Python on any Java platform."

In the case of Jython you could perhaps say that Python bytecode is
"exactly like Java". However, in the case of regular Python, it's
closer to say that Python bytecode is much the same _idea_ as Java
bytecode.

Jason

Aug 10 '05 #8

P: n/a
In article <11**********************@g43g2000cwa.googlegroups .com>,
"Jason Drew" <ja*********@gmail.com> wrote:
Roy Smith wrote: "there's a system called Jython, which lets you
compile Java source to Python byte code."

Don't you have that the wrong way 'round?


Duh, of course I do! Thanks for the correction.
Aug 11 '05 #9

P: n/a
bruno modulix wrote:
You can tell buy the most common use. bash is a scripting language,
javascript is a scripting language, perl is a scripting language, php is
a scripting language, Python is *not* a scripting language !-)


Perhaps a better definition - the term 'scripting language' is
increasingly being used by CTOs as a justification for saving money by
putting large chunks of their workforces on lower pay scales - an
attitude of 'scripters aren't as skilled as real programmers, so don't
deserve the same pay'.

To me, the term is archic. What 'scripting language' means to me is:
1. insufficient facilities for general purpose or 'serious' programming
2. ability to get simple useful programs up and working quickly
3. absence of a hack/compile/link/test cycle.

What makes 1 and 3 redundant is that linkage mechanisms have diversified
over the years. For instance, java and python's 'import' statements,
java's CLASSPATH and python's 'sys.path'.

I guess a language could be called a 'scripting language' if:
- the source code can be executed directly, and/or
- source need not be converted to a separate file in a
non-human-readable format before it can be executed, and/or
- a change to the source file automatically causes a change in
runtime behaviour

By these, Python is most definitely a scripting language, and joins Perl
and PHP. Whereas changes to java source files don't change runtime
behaviour.

OTOH, Python is also a compiled language, since it can be 'fixed' into a
n executable binary format.

--
Cheers
EB

--

One who is not a conservative by age 20 has no brain.
One who is not a liberal by age 40 has no heart.
Aug 11 '05 #10

P: n/a
bruno modulix wrote:
bash is a scripting language,
Bash is a shell. It is frequently used for scripting, but that is only
a secondary purpose.
javascript is a scripting language,
Yes, but it's a particularly specialized one.
perl is a scripting language,
Blasphemy! Perl is a dynamic language, entirely suitable for large
applications. I've written some pretty big programs entirely in Perl,
and extended it with C and C++ to make it fit nicely into existing
application frameworks.
php is a scripting language,
OK, but it's also awfully specialized.
Python is *not* a scripting language !-)


It's a scripting language, among other things. Why do you think
non-imported source files are not automatically compiled to pyc's?
Aug 11 '05 #11

P: n/a
On Thu, 11 Aug 2005 15:51:45 +1200, Evil Bastard <sp**@me.please>
declaimed the following in comp.lang.python:
To me, the term is archic. What 'scripting language' means to me is:
1. insufficient facilities for general purpose or 'serious' programming
2. ability to get simple useful programs up and working quickly
I fear I was spoiled by the Amiga in the late 80s, where ARexx
qualified as a true scripting language; since most good applications
included an ARexx port... (and some also included a ARexx compatible
function library).

{pseudo example -- its been over 10 years and I don't want to dig up
manuals to recall what the editor commands really were, so this is sort
of "vi"; $ is <esc>}

address ed
"3dw"
"iThis text is inserted$"
"$ZZ"
address command
"copy " file "PRT:"

To me, that is "scripting" -- using one program to feed commands
to another. Those applications that supplied a function library allowed
for usage closer to VBA/COM style... import the library, then call
functions directly.
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Aug 11 '05 #12

P: n/a
On 2005-08-11, Dennis Lee Bieber <wl*****@ix.netcom.com> wrote:
On Thu, 11 Aug 2005 15:51:45 +1200, Evil Bastard <sp**@me.please>
declaimed the following in comp.lang.python:
To me, the term is archic. What 'scripting language' means to me is:
1. insufficient facilities for general purpose or 'serious' programming
2. ability to get simple useful programs up and working quickly

[...]
To me, that is "scripting" -- using one program to feed commands
to another. Those applications that supplied a function library allowed
for usage closer to VBA/COM style... import the library, then call
functions directly.


To me, a "scripting language" is one intended to "sumulate" a
user: a language that is used to run other programs in
more-or-less the same manner a normal user would. Something
that is intended to be used to automate a sequence of
operations that would otherwise be performed by a user typing or clicking
in a UI.

Bash is a scripting language. Python isn't.

When compared with something like bash, in Python it's not
particularly easy to run other programs and manipulate the
programs' input/output streams. It can be done, but the
semantics used to do so are identical to C (which nobody seems
to think is a scripting language).

Python is a general purposeprogramming language.

--
Grant Edwards grante Yow! Hey, I LIKE that
at POINT!!
visi.com
Aug 11 '05 #13

P: n/a
On Thu, 11 Aug 2005 15:51:45 +1200, Evil Bastard <sp**@me.please> wrote:

I guess a language could be called a 'scripting language' if:
- the source code can be executed directly, and/or
- source need not be converted to a separate file in a
non-human-readable format before it can be executed, and/or
- a change to the source file automatically causes a change in
runtime behaviour

By these, Python is most definitely a scripting language, and joins Perl
and PHP. Whereas changes to java source files don't change runtime
behaviour.


It wouldn't be particularly difficult to invoke Java by a shell
script that checks to see if source has changed and if so
recompiles it. If such a script became part of standard Java, would
Java then be a scripting language?

--
Email: zen19725 at zen dot co dot uk
Aug 11 '05 #14

P: n/a
Evil Bastard wrote:
bruno modulix wrote:
You can tell buy the most common use. bash is a scripting language,
javascript is a scripting language, perl is a scripting language, php is
a scripting language, Python is *not* a scripting language !-)
Perhaps a better definition - the term 'scripting language' is
increasingly being used by CTOs as a justification for saving money by
putting large chunks of their workforces on lower pay scales - an
attitude of 'scripters aren't as skilled as real programmers, so don't
deserve the same pay'.

To me, the term is archic. What 'scripting language' means to me is:
1. insufficient facilities for general purpose or 'serious' programming
2. ability to get simple useful programs up and working quickly
3. absence of a hack/compile/link/test cycle.


My view too.
What makes 1 and 3 redundant is that linkage mechanisms have diversified
over the years. For instance, java and python's 'import' statements,
java's CLASSPATH and python's 'sys.path'.

I guess a language could be called a 'scripting language' if:
- the source code can be executed directly, and/or
- source need not be converted to a separate file in a
non-human-readable format before it can be executed, and/or
- a change to the source file automatically causes a change in
runtime behaviour

By these, Python is most definitely a scripting language, and joins Perl
and PHP. Whereas changes to java source files don't change runtime
behaviour.


Though they prefer to be called "agile languages" nowadays.

Reinhold
Aug 11 '05 #15

P: n/a
Evil Bastard wrote:
I guess a language could be called a 'scripting language' if:
- the source code can be executed directly, and/or
- source need not be converted to a separate file in a
non-human-readable format before it can be executed, and/or
- a change to the source file automatically causes a change in
runtime behaviour


That kind of a language is typically called an interpreted
language, in contrast to a compiled. But it's really not an
aspect of the language, but rather of the tools being used
to convert the source code to "action" on a computer. I've
used both interpreted and compiled versions of Pascal and
BASIC, and I know of interpreted versions of C etc.

In a way, I guess Python's problem in achieving the popularity
it deserves is due to its versitility. Python works well as
an embedded macro language, and is used like that in both off
the shelf software and bespoke systems. It's useful as a scripting
language and is used in that way by NASA, ILM etc. It's also
very useful for building all sorts of software without mixing in
other languages or programs, and can replace VB, C++, COBOL, Java
or what have you. How do you sell this without making it sound
like snake oil? (Particularly with that name! :)

While other P-languages are used beyond their intended use, Perl
*is* basically a scripting language. The strong point of Perl is
that it's a "unified" replacement for a whole bunch of Unix tools.
PHP is for embedding functionality in web pages. Free cross
platform ASP. They explaining Python in two sentences!
Aug 12 '05 #16

P: n/a
Magnus Lycka wrote:
<cut>
or what have you. How do you sell this without making it sound
like snake oil? (Particularly with that name! :)

<cut>
<JediMindTrick>
This *is* the languange you are looking for ...
</JediMindTrick>

Stops the argument every time, although afterwards they look kind a
funny at me.

--
mph
Aug 12 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.