What is Python?!

R

Robert Wierschke

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
 
A

Adriano Varoli Piazza

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.
 
R

Robert Wierschke

Adriano said:
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
 
P

Peter Hansen

Robert said:
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
 
R

Roy Smith

Robert Wierschke said:
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.
 
P

phil hunt

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.
 
B

bruno modulix

Roy said:
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.
 
J

Jason Drew

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
 
R

Roy Smith

"Jason Drew said:
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.
 
E

Evil Bastard

bruno said:
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.
 
J

Jeff Schwab

bruno said:
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?
 
D

Dennis Lee Bieber

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.
--
 
P

phil hunt

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?
 
G

Grant Edwards

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.
 
R

Reinhold Birkenfeld

Evil said:
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
 
M

Magnus Lycka

Evil said:
> 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!
 
M

Martin P. Hellwig

Magnus Lycka wrote:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,311
Members
47,985
Latest member
kazewi

Latest Threads

Top