Discuss Scratch

DigiTechs3
New Scratcher
51 posts

JavaScript vs. Python???

Jonathan50 wrote:

PyPy is very fast. I've heard that Spidermonkey and V8 and Chakra are fast, I don't know how fast.

V8 and Chakra are a lot faster than Python's JIT, last I checked.
EDIT: Just did a quick Google search, and this appears to be backing up what I thought.

Either way, if you're doing some heavy calculations, then you probably don't want to be using a scripting language anyway, regardless of speed. You're better off using a compiled language, or at least some C library glue to optimise the calculation at compile-time. Most websites shouldn't need this though, so using something like node.js will be fine.

In general though, I wouldn't recommend doing any of these unless you know how to load balance and cache properly - you really should learn how to do at least mediocre load-balancing and varnish caching, because that's the sort of skill that large corporations are looking for.

Last edited by DigiTechs3 (May 11, 2016 09:08:44)

DigiTechs3
New Scratcher
51 posts

JavaScript vs. Python???

Oh bother, I forgot I'm still a new scratcher.

DigiTechs3 wrote:

this

should link to http://karlheinzniebuhr.github.io/en/2015/09/28/C-vs-Go-vs-pypy-vs-Python/

Last edited by DigiTechs3 (May 11, 2016 09:10:34)

herohamp
Scratcher
1000+ posts

JavaScript vs. Python???

NateSprtz wrote:

novice27b wrote:

They are all useful languages. Do you have anything specific in mind that you would like to create?
I either want to make games or websites.
well website you need
HTML Javascript and CSS

and for games what type? Webgame?
BookOwl
Scratcher
1000+ posts

JavaScript vs. Python???

jokebookservice1 wrote:

I'd say that Python is easier to learn than JavaScript (but I prefer JS anyway). I can't speak for ruby, but I've heard it is a really nice language. Python seems much simpler, so I would recommend learning it first.

I guess it is a matter of opinion, so I think you could compare the languages:

So that hopefully gave you a quick overview in the differences between the syntaxes of the two languages.
Your Python is mix of 2 and 3. You should use input instead of raw_input.

Anyway, I think that Python is better for non-web (except server) usage, and JS for websites.
BKFighter
Scratcher
1000+ posts

JavaScript vs. Python???

If you have no need for a data base, (i.e. games without a login, user data, or highscores,) I would recommend JS. I've only used Python for about ten minutes, but I very strongly prefer JS. Canvas+JS is very powerful for beginning to make games.
liam48D
Scratcher
1000+ posts

JavaScript vs. Python???

BKFighter wrote:

If you have no need for a data base, (i.e. games without a login, user data, or highscores,) I would recommend JS. I've only used Python for about ten minutes, but I very strongly prefer JS. Canvas+JS is very powerful for beginning to make games.
Who says your backend/database can't be programmed with JavaScript?
BKFighter
Scratcher
1000+ posts

JavaScript vs. Python???

liam48D wrote:

BKFighter wrote:

If you have no need for a data base, (i.e. games without a login, user data, or highscores,) I would recommend JS. I've only used Python for about ten minutes, but I very strongly prefer JS. Canvas+JS is very powerful for beginning to make games.
Who says your backend/database can't be programmed with JavaScript?
Not I. I just said that if there's no database, the clear cut choice is JS (or Unity, but I've never actually need to (or have) used it).
evilpacman10
Scratcher
87 posts

JavaScript vs. Python???

scratchyone wrote:

I would recommend javascript because you can program websites, and then program applications and server side software with the same language (www.nodejs.org).

YEESS!!! AMEN WHOO!

GET A PI (They are epic)


evilpacman10
Scratcher
87 posts

JavaScript vs. Python???

evilpacman10 wrote:

scratchyone wrote:

I would recommend javascript because you can program websites, and then program applications and server side software with the same language (www.nodejs.org).

YEESS!!! AMEN WHOO!

GET A PI (They are epic)



No wait, sorry, wrong qoute, because of python's ‘pickle’ function it is especially good for games with databases.
NickyNouse
Scratcher
1000+ posts

JavaScript vs. Python???

BKFighter wrote:

liam48D wrote:

BKFighter wrote:

If you have no need for a data base, (i.e. games without a login, user data, or highscores,) I would recommend JS. I've only used Python for about ten minutes, but I very strongly prefer JS. Canvas+JS is very powerful for beginning to make games.
Who says your backend/database can't be programmed with JavaScript?
Not I. I just said that if there's no database, the clear cut choice is JS (or Unity, but I've never actually need to (or have) used it).
also, js lets you store stuff on the browser so that might work for some things too
Icey29
Scratcher
500+ posts

JavaScript vs. Python???

There's a lot of technical discussion going on here, so for the purposes of the OP, I'll try and condense this into layman's terms.

Both are incredibly versatile languages and are extremely powerful. Python is similar in syntax to Scratch, so if you haven't learned a “traditional” programming language, you may find this very beneficial. JavaScript is used everywhere- especially in websites, so if you want to create something interactive, it would definitely be your best bet.

As Scratchyone cited, looking into Node.js could be really helpful once you get comfortable with the language.

I think that's it. Have I missed something?
__init__
Scratcher
1000+ posts

JavaScript vs. Python???

websites – Python with Pyjs
games – Python
Dylan5797
Scratcher
1000+ posts

JavaScript vs. Python???

__init__ wrote:

websites – Python with Pyjs
games – Python
+1
Firedrake969
Scratcher
1000+ posts

JavaScript vs. Python???

As much as I like Python for backend, I think JS is better for realtime things.
Ethan_1
Scratcher
100+ posts

JavaScript vs. Python???

Dylan5797 wrote:

__init__ wrote:

websites – Python with Pyjs
games – Python
+1
Or even better http://transcrypt.org/

I mean, honestly, if you want to program for the web, it is better to write JS, until WebAssembly is better tooled and more available.
Bitesh
Scratcher
2 posts

JavaScript vs. Python???

WELL I USE PYTHON, BUT JAVA SCRIPT IS USED FOR MORE THINGS SO… REALLY I THINK YOU SHOULD DO JAVA SCRIPT THEN THINK ABOUT MOVING ON TO PYTHON…. Duh I'm going to do it the other way around…..
liam48D
Scratcher
1000+ posts

JavaScript vs. Python???

Bitesh wrote:

WELL I USE PYTHON, BUT JAVA SCRIPT IS USED FOR MORE THINGS SO… REALLY I THINK YOU SHOULD DO JAVA SCRIPT THEN THINK ABOUT MOVING ON TO PYTHON…. Duh I'm going to do it the other way around…..
(emphasis mine)

Based on that why would you want to move on from JavaScript to Python?
Firedrake969
Scratcher
1000+ posts

JavaScript vs. Python???

liam48D wrote:

Bitesh wrote:

WELL I USE PYTHON, BUT JAVA SCRIPT IS USED FOR MORE THINGS SO… REALLY I THINK YOU SHOULD DO JAVA SCRIPT THEN THINK ABOUT MOVING ON TO PYTHON…. Duh I'm going to do it the other way around…..
(emphasis mine)

Based on that why would you want to move on from JavaScript to Python?
BECAUSE DATA ANALYSIS
nanaIan
Scratcher
8 posts

JavaScript vs. Python???

BKFighter wrote:

liam48D wrote:

BKFighter wrote:

If you have no need for a data base, (i.e. games without a login, user data, or highscores,) I would recommend JS. I've only used Python for about ten minutes, but I very strongly prefer JS. Canvas+JS is very powerful for beginning to make games.
Who says your backend/database can't be programmed with JavaScript?
Not I. I just said that if there's no database, the clear cut choice is JS (or Unity, but I've never actually need to (or have) used it).
Even if there is a database, the clear-cut choice is JS.

nodejs ftw
botcrusher
Scratcher
500+ posts

JavaScript vs. Python???

You can't “clear cut” that simply. it comes down to preference and what the language is suited for.

For example, In my province (Canada uses provinces, not states) introduction to programming is done via a language called Turing.
Is it useful? no, not really… but it teaches you many of the concepts you will need for later languages.

After Turing, the language of choice is down to the teacher's discretion. In my case this was Python. Python is incredibly powerful, can be compiled to C++, and personally, i'm in love. Python is quite forgiving, there's a passed around ‘rule’ that it is easier to beg forgiveness than ask for permission.

What does this mean?

Well, if you (the coder) makes a mistake, or the system (someone yanked ethernet cable while sending data) and this causes an error the two following lines are your friend:

try:
except:

you try to do something, and if it fails, it moves on to except.
arguably the best way to use this is:

except Exception as e: print(e)
this prints the error so you can catch it, maybe try again, or do something differently. (Tell the user they've just switched to offline mode)

Powered by DjangoBB