Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #63687 > unrolled thread
| Started by | pintreo mardi <bigearl497@outlook.com> |
|---|---|
| First post | 2014-01-11 00:07 -0800 |
| Last post | 2014-01-12 18:53 +0000 |
| Articles | 14 — 10 participants |
Back to article view | Back to comp.lang.python
Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? pintreo mardi <bigearl497@outlook.com> - 2014-01-11 00:07 -0800
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Chris Angelico <rosuav@gmail.com> - 2014-01-11 19:21 +1100
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? pintreo mardi <bigearl497@outlook.com> - 2014-01-11 02:10 -0800
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-11 10:51 +0000
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-01-11 10:47 +0000
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Roy Smith <roy@panix.com> - 2014-01-11 10:45 -0500
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Steve Hayes <hayesstw@telkomsa.net> - 2014-01-12 07:08 +0200
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Chris Angelico <rosuav@gmail.com> - 2014-01-12 16:58 +1100
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Rotwang <sg552@hotmail.co.uk> - 2014-01-12 14:36 +0000
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Chris Angelico <rosuav@gmail.com> - 2014-01-13 01:44 +1100
Re:Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Dave Angel <davea@davea.name> - 2014-01-11 19:37 -0500
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? matej@ceplovi.cz (Matěj Cepl) - 2014-01-12 02:36 +0100
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Dan Stromberg <drsalists@gmail.com> - 2014-01-11 18:43 -0800
Re: Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? Grant Edwards <invalid@invalid.invalid> - 2014-01-12 18:53 +0000
| From | pintreo mardi <bigearl497@outlook.com> |
|---|---|
| Date | 2014-01-11 00:07 -0800 |
| Subject | Open Question - I'm a complete novice in programming so please bear with me...Is python equivalent to C, C++ and java combined? |
| Message-ID | <18b67e59-39d1-41e2-8977-b1c449b132e7@googlegroups.com> |
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!!
[toc] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-01-11 19:21 +1100 |
| Message-ID | <mailman.5318.1389428523.18130.python-list@python.org> |
| In reply to | #63687 |
On Sat, Jan 11, 2014 at 7:07 PM, pintreo mardi <bigearl497@outlook.com> wrote: > 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!! 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
[toc] | [prev] | [next] | [standalone]
| From | pintreo mardi <bigearl497@outlook.com> |
|---|---|
| Date | 2014-01-11 02:10 -0800 |
| Message-ID | <80444995-a0b3-4f5f-8e7e-6f65906d27ab@googlegroups.com> |
| In reply to | #63688 |
On Saturday, January 11, 2014 1:51:53 PM UTC+5:30, Chris Angelico wrote: > On Sat, Jan 11, 2014 at 7:07 PM, pintreo mardi <bigearl497@outlook.com> wrote: > > > 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!! > > > > 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.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-01-11 10:51 +0000 |
| Message-ID | <mailman.5326.1389437706.18130.python-list@python.org> |
| In reply to | #63694 |
On 11/01/2014 10:10, pintreo mardi wrote: > On Saturday, January 11, 2014 1:51:53 PM UTC+5:30, Chris Angelico wrote: >> On Sat, Jan 11, 2014 at 7:07 PM, pintreo mardi <bigearl497@outlook.com> wrote: >> >>> 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!! >> >> >> >> 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. > 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. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2014-01-11 10:47 +0000 |
| Message-ID | <mailman.5325.1389437246.18130.python-list@python.org> |
| In reply to | #63687 |
On 11/01/2014 08:07, pintreo mardi wrote: > 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 -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2014-01-11 10:45 -0500 |
| Message-ID | <roy-24194C.10455311012014@news.panix.com> |
| In reply to | #63687 |
In article <18b67e59-39d1-41e2-8977-b1c449b132e7@googlegroups.com>, pintreo mardi <bigearl497@outlook.com> wrote: > 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 :-)
[toc] | [prev] | [next] | [standalone]
| From | Steve Hayes <hayesstw@telkomsa.net> |
|---|---|
| Date | 2014-01-12 07:08 +0200 |
| Message-ID | <cd84d9dfi4bvs8o2her0qt9ethppuvpj7o@4ax.com> |
| In reply to | #63709 |
On Sat, 11 Jan 2014 10:45:53 -0500, Roy Smith <roy@panix.com> wrote: >In article <18b67e59-39d1-41e2-8977-b1c449b132e7@googlegroups.com>, > pintreo mardi <bigearl497@outlook.com> wrote: > >> 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: > 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). -- Steve Hayes from Tshwane, South Africa Web: http://www.khanya.org.za/stevesig.htm Blog: http://khanya.wordpress.com E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-01-12 16:58 +1100 |
| Message-ID | <mailman.5357.1389506333.18130.python-list@python.org> |
| In reply to | #63750 |
On Sun, Jan 12, 2014 at 4:08 PM, Steve Hayes <hayesstw@telkomsa.net> wrote: > 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). Python puts heavy focus on code readability (which also means it's easy to write). So it gains you hugely for small scripts, less so for things that need to run millions of times a second. Python has a variety of libraries that make it well suited to internet applications (as server or as client). Python, especially as of version 3.3, is superb at handling internationalization, Unicode, and related messes - you can sort out files of different encodings and rewrite them in something consistent (eg UTF-8). It may seem a bit harder at first, as you're forced to think about the meaning of bytes and what's text and so on, but it's worth it. Python is NOT good at massively parallel numerical calculations.... on its own. But there are libraries that can do that sort of thing for you (NumPy, SciPy); I've no idea how good they are because I neither use them nor write code that would benefit from them, but they're extremely popular and well-used. As a general rule, if your program is likely to spend most of its time waiting (for the disk, the network, the user, etc), then Python is probably at least as good a choice as C, Java, or any other language, and the question will come down to library support and such. Python is also an excellent "super pocket calculator". The reasonably-compact notation for aggregate operations (list comprehensions and such) lets you work with a functional programming style, and you can use step-by-step imperative programming in the same way. Want to calculate the average result of rolling six six-sided dice, and discarding any results below 14? Try this: http://www.kickstarter.com/projects/916188323/doublesix-dice-roll-better/comments?cursor=5623335#comment-5623334 (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.) The incremental execution of Python's interactive interpreter (REPL) is extremely convenient for this. I personally like using IDLE for this, as (unlike command-line Python) it will recall and edit an entire suite, rather than one line at a time. Extremely handy. ChrisA
[toc] | [prev] | [next] | [standalone]
| From | Rotwang <sg552@hotmail.co.uk> |
|---|---|
| Date | 2014-01-12 14:36 +0000 |
| Message-ID | <lau998$lnh$1@dont-email.me> |
| In reply to | #63753 |
On 12/01/2014 05:58, Chris Angelico wrote: > [...] > > (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
[toc] | [prev] | [next] | [standalone]
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2014-01-13 01:44 +1100 |
| Message-ID | <mailman.5367.1389537878.18130.python-list@python.org> |
| In reply to | #63769 |
On Mon, Jan 13, 2014 at 1:36 AM, Rotwang <sg552@hotmail.co.uk> wrote: > On 12/01/2014 05:58, Chris Angelico wrote: >> >> (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
[toc] | [prev] | [next] | [standalone]
| From | Dave Angel <davea@davea.name> |
|---|---|
| Date | 2014-01-11 19:37 -0500 |
| Message-ID | <mailman.5343.1389486949.18130.python-list@python.org> |
| In reply to | #63687 |
pintreo mardi <bigearl497@outlook.com> Wrote in message: > 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
[toc] | [prev] | [next] | [standalone]
| From | matej@ceplovi.cz (Matěj Cepl) |
|---|---|
| Date | 2014-01-12 02:36 +0100 |
| Message-ID | <mailman.5348.1389490584.18130.python-list@python.org> |
| In reply to | #63687 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2014-01-11, 08:07 GMT, you wrote: > 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. - From one side this answer is probably as meaningful as the one from the Alice in Wonderland (http://www.gutenberg.org/files/19033/19033-h/19033-h.htm, page 35): “Why is a raven like a writing-desk?” These are just different programming languages each designed for different purpose. On the other hand what people said about Turing complete langauges is true as well. So, yes it is true that any Turing complete language you can write anything you wrote in another Turing complete language. It doesn’t mean however that it would be as easy or as efficient tool for doing so. Some languages are specialized for high-power low-level specialist programming of low-level stuff (e.g., almost all serious operating systems are written in C), some are better suited for writing enormous complicated projects consisting of thousands of modules (Java, C++, Ada), some are designed to be very easy to write (that doesn’t mean primitive) although the speed and processing power of the result may suffer a little bit (JavaScript, Python, Perl, Ruby). If you ask for the language to start to learn programming as such, then Python was oriiginally intended exactly for that purpose (fortunately, it was written so well, it is now used en masse for “serious” large programming projects as well). FOr the list of resources take a look at https://wiki.python.org/moin/BeginnersGuide/NonProgrammers . Particularly, I’ve heard a lot of good things about “How to Think Like a Computer Scientist”. You won’t hurt yourself if you start there. Best, Matěj -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iD8DBQFS0fGP4J/vJdlkhKwRAu6TAKCCdGP9b3z2M+NJlIY4HnqZFi+v3gCfYgE0 69QHLyfyG//dFhb9pcjdoNk= =y2k/ -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Dan Stromberg <drsalists@gmail.com> |
|---|---|
| Date | 2014-01-11 18:43 -0800 |
| Message-ID | <mailman.5351.1389494591.18130.python-list@python.org> |
| In reply to | #63687 |
On Sat, Jan 11, 2014 at 12:07 AM, pintreo mardi <bigearl497@outlook.com> wrote: > 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 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
[toc] | [prev] | [next] | [standalone]
| From | Grant Edwards <invalid@invalid.invalid> |
|---|---|
| Date | 2014-01-12 18:53 +0000 |
| Message-ID | <lauobs$qrq$1@reader1.panix.com> |
| In reply to | #63687 |
On 2014-01-11, pintreo mardi <bigearl497@outlook.com> wrote:
> 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.
--
Grant Edwards grant.b.edwards Yow! Look into my eyes and
at try to forget that you have
gmail.com a Macy's charge card!
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web