Open Question - I'm a complete novice in programming so please bearwith me...Is python equivalent to

P

pintreo mardi

Hi, I've just begun to learn programming, I have an open question for the group:
Is the Python language an all in one computer language which could replace C, C++, Java etc.. I only ask becuase I am starting off with python and I want to learn everything in basic and advanced programming with python itself...So any advice and suggestions would be more than welcome.
Thanks!!
 
C

Chris Angelico

Hi, I've just begun to learn programming, I have an open question for thegroup:
Is the Python language an all in one computer language which could replace C, C++, Java etc.. I only ask becuase I am starting off with python and Iwant to learn everything in basic and advanced programming with python itself...So any advice and suggestions would be more than welcome.
Thanks!!

Python is a viable applications language, yes. There's nothing you
can't write in Python that you can write in (say) Java - both
languages are what's called "Turing complete". Every language has its
special focus, though, so there'll be some things that are far easier
in one language than another. In general, Python is a fine language
for simple tasks like printing "Hello, world", for scripting, for
writing GUI programs, and for building web applications. It's not
restricted to tiny projects or to huge ones. There's no critical limit
on the amount of "stuff" you can do before the code gets unwieldy, for
instance, nor is there a level below which it's just too much hassle
to put together a program.

ChrisA
 
P

pintreo mardi

Python is a viable applications language, yes. There's nothing you

can't write in Python that you can write in (say) Java - both

languages are what's called "Turing complete". Every language has its

special focus, though, so there'll be some things that are far easier

in one language than another. In general, Python is a fine language

for simple tasks like printing "Hello, world", for scripting, for

writing GUI programs, and for building web applications. It's not

restricted to tiny projects or to huge ones. There's no critical limit

on the amount of "stuff" you can do before the code gets unwieldy, for

instance, nor is there a level below which it's just too much hassle

to put together a program.



ChrisA

Thanks mate!! I'm a bit relieved. If I could get some really good books on programming with python, those for the beginners would be very helpful.
 
M

Mark Lawrence

Hi, I've just begun to learn programming, I have an open question for the group:
Is the Python language an all in one computer language which could replace C, C++, Java etc.. I only ask becuase I am starting off with python and I want to learn everything in basic and advanced programming with python itself...So any advice and suggestions would be more than welcome.
Thanks!!

https://mail.python.org/pipermail/python-list/2002-November/141486.html
 
M

Mark Lawrence

Thanks mate!! I'm a bit relieved. If I could get some really good books on programming with python, those for the beginners would be very helpful.

No, no, no, this can't be happening!!! Surely outlook can't have caught
double spaced google disease, please see
https://wiki.python.org/moin/GoogleGroupsPython for a description of the
original problem and compare it to what's shown above.
 
R

Roy Smith

pintreo mardi said:
Hi, I've just begun to learn programming, I have an open question for the
group:
Is the Python language an all in one computer language which could replace C,
C++, Java etc.. I only ask becuase I am starting off with python and I want
to learn everything in basic and advanced programming with python itself...So
any advice and suggestions would be more than welcome.
Thanks!!

That's a really hard question to answer, or at least to answer well.

At a theoretical level, when you ask, "Is Python equivalent to C, C++
and Java", the answer is "yes". In computer science, programming
languages are classified by whether they are "Turing Complete" or not
(google that for more info). In theory, any Turing Complete language is
capable of writing all programs which can be written in any other Turing
Complete language. All of the languages you mention are Turing
Complete, so, theoretically, they are all equivalent.

But, at a more practical level, some languages are easier to learn, some
run faster, some are more portable, some are more convenient to use,
etc. If I had to rank the languages you mention by a few categories,
I'd say something like:

Python: Easiest to learn (and use), slowest execution speed.

C: Pretty easy to learn, but difficult to write large projects in,
fastest execution speed.

C++: Hardest to learn, hard to use, speed close to C.

Java: Somewhere in-between Python and C++ on all counts.

All of these are currently in widespread commercial use today, so you
can't go too far wrong staring out with any of them. The TIOBE people
have been tracking programming language popularity for a long time
(http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html), so
that's a good place to get some vague idea of what's hot and what's not.

One thing to be aware of is that some programming domains require a
specific language. If you want to do iOS, you need Objective C. For
Android, Java. Web front-end programming, Javascript. No getting away
from those. In the server environment, it's a much more wide-open
field. People write web servers, for example, in Python, Ruby, Scala,
Javascript, PHP, Java, and probably a host of other languages.

This has already turned into a longer essay than I intended, but there's
just one thing I wanted to add. Whatever you pick to learn first,
realize that if you embark on a life-long career in programming, it
won't be your last. Languages come and go. I've done serious work in
(in vaguely chronological order) Fortran, C, Python, Tcl, Perl, C++, and
PHP.

So, pick one, spend a year getting really good at it, then pick another
language, preferably one that's very different, and learn that too.
Repeat every so often :)
 
D

Dave Angel

pintreo mardi said:
Hi, I've just begun to learn programming, I have an open question for the group:
Is the Python language an all in one computer language which could replace C, C++, Java etc.. I only ask becuase I am starting off with python and I want to learn everything in basic and advanced programming with python itself...So any advice and suggestions would be more than welcome.
Thanks!!

As others have said you can do nearly anything in any of those
languages. But you can expect to learn and use many over time.
I've used about 35 professionally, and a few more for fun. I've
done substantial work in machine language and also in microcode.
Sometimes I had to write the assembler, simulator, and debugger
while the actual machine was being designed. Was python an
appropriate language to write add and subtract in? Nope.


--
DaveA nr



----Android NewsGroup Reader----
http://www.piaohong.tk/newsgroup
 
D

Dan Stromberg

Hi, I've just begun to learn programming, I have an open question for thegroup:
Is the Python language an all in one computer language which could replace C, C++, Java etc.. I only ask becuase I am starting off with python and Iwant to learn everything in basic and advanced programming with python itself...So any advice and suggestions would be more than welcome.
Thanks!!

As others have mentioned, they're all turing-complete. In other
words, with an infinite memory and infinite coding patience, they can
all solve the same problems.

The main distinctions, at least to my mind, are:
1) Python tends to require fewer words to solve the same problems, but
tends to be slow running.
2) C tends to be very fast running, but takes a lot of words to solve
the same problems, and is prone to hard-to-fix memory errors
3) C++ and Java aren't that different in performance today, because of
Java's good JIT.
4) Java's not great for systems programming (apparently can't detect
symlink races for example), but C, C++ and sometimes Python are.

Each language will tend to have API's (Application Programming
Interfaces) that make some classes of problems easier or harder.
API's are basically reusable code you can use to make your own
problems quicker and easier.

You probably wouldn't write an operating system kernel in Python -
it'd be too slow. However, writing an application in Python might be
a very good use of time.

If Python proves too slow for a problem (which is uncommon), you can
rewrite small portions in C to get good performance. Also, there is
another implementation of Python called PyPy that's much faster than
the reference implementation, which is known as CPython.

C++ and Java cover similar kinds of programming - they're both object
oriented C-like languages. However, C++ is more prone to memory
errors than Java, and I'm told that C++ has many incompatible
implementations of fundamental things like strings. For these
reasons, I'd recommend Java over C++ for most things (except systems
programming).

C, C++ and Java are all statically, manifestly typed. Python is duck
typed. These are fundamentally different approaches to program
correctness. In C, C++ and Java, programmers tend to assume that if a
program compiles, it's working. This is not a great assumption, but
it isn't that far off the mark, either. Python on the other hand,
will compile a lot more programs than those that work - for this
reason, it's a very good idea to use automated tests with Python.
Automated tests are a good idea with C, C++ and Java too, just not as
crucial.

HTH
 
S

Steve Hayes

That's a really hard question to answer, or at least to answer well.

At a theoretical level, when you ask, "Is Python equivalent to C, C++
and Java", the answer is "yes". In computer science, programming
languages are classified by whether they are "Turing Complete" or not
(google that for more info). In theory, any Turing Complete language is
capable of writing all programs which can be written in any other Turing
Complete language. All of the languages you mention are Turing
Complete, so, theoretically, they are all equivalent.

But, at a more practical level, some languages are easier to learn, some
run faster, some are more portable, some are more convenient to use,
etc. If I had to rank the languages you mention by a few categories,
I'd say something like:

I think the significant thing is that some languages are easier to use for
some things than for others. Though you can use any language to write any kind
of program in theory, in practice some languages are designed to write certain
kinds of programs more easily and more quickly -- Prolog for AI programs, for
example.

So the question is, which kinds of programs is Python best for?

I'm a novice at it, so it's a question that concerns me. From what I've heard
and read, it seems to be a fairly good general-purpose language, and it seems
to be most used for writing web applications (though that is not something I
am particularly interested in).
 
C

Chris Angelico

(BTW, is there no better notation than six nested for/range for doing
6d6? I couldn't think of one off-hand, but it didn't really much
matter anyway.)


If you're willing to do an import, then how about this:
from itertools import product
len([x for x in product(range(1, 7), repeat = 6) if sum(x) < 14])/6**6
0.03587962962962963

Should have known itertools would have something. That's a little more
complicated to try to explain, but it's a lot shorter.

ChrisA
 
G

Grant Edwards

Hi, I've just begun to learn programming, I have an open question for
the group: Is the Python language an all in one computer language
which could replace C, C++, Java etc..

No. Python can not replace C in a number of application areas:

* Bare-metal applications without an OS.

* Low-resource applications with limited memory (like a few KB).

* Device driver and kernel modules for OSes like Linux, Unix, (and,
AFAIK, Windows).

* Computationally intensive applications where there isn't a library
available written C or FORTRAN to do the heavy lifting.

For general application programming on a server or PC, then Python can
replace many/most uses of C/C++/Java.
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top