What is the difference between PyPy and Python? are there lot of differences?

A

ArrC

Hey guys,i am a python newbie,
i just read a qustion on quora where it said that quora quys used pypy (and pylon) to develop quora.

So, i want to know what are the core diff btw PyPy and Python ?

And they also talked about the lack of type check in python.

So, how does it help (strongly typed) in debugging?

Thanks
 
C

Chris Angelico

So, i want to know what are the core diff btw PyPy and Python ?

Python is a language; PyPy is one implementation of that language. The
"classic" implementation of Python is CPython, not to be confused with
Cython; there are a few others as well. If you talk of "installing
Python", it probably means CPython.
And they also talked about the lack of type check in python.

So, how does it help (strongly typed) in debugging?

Sloppy but brief explanation: Python's variables are typeless; its
objects are strongly typed.

Longer explanation: Every piece of data in Python is an object.
Objects can be referenced by names; one object can have more than one
name pointing to it. Any name can point to any value, which is
somewhat the opposite of "strongly-typed variables" in other
languages. For instance:

a = "Hello" # a points to or "holds" a string
a = 234 # a now points to an integer
a = 1.0 # a now points to a float
a = [1,2,3] # a now has a list (array)

In debugging, all you generally care about is "what does this object
point to". I guess whether or not this makes things easier or harder
depends a lot on what sort of bugs you're tracking down.

Hope that helps!

Chris Angelico
 
S

sturlamolden

And they also talked about the lack of type check in python.

So, how does it help (strongly typed) in debugging?


Python is strongly typed. There are no static type checks in Python.
Type checks are done at runtime. Dynamic typing does not mean that
Python is a weakly typed language.

The question of debugging is often raised, particularly by Java heads:

In Python, the "doctest" and "unittest" modules can be used to verify
that code works according to specification (e.g. trap type errors),
and are common alternatives to static type checks.

http://docs.python.org/release/3.2/library/doctest.html
http://docs.python.org/release/3.2/library/unittest.html

It is a good practice to always write tests for your code.

Python 3.x also has function argument and return value type
annotations, which is a further guard against type errors:

http://www.python.org/dev/peps/pep-3107/


Sturla
 
I

Ian Kelly

One of the main difference is that pypy supports only R-Python, which stands
for 'Restricted Python".
It is a subset of C-python language.

This is wrong. The PyPy *interpreter* is written in RPython. At the
application level, PyPy supports the full syntax and semantics of
Python (with a few minor differences of the same sort that you find in
Jython or IronPython).
 
T

Terry Reedy

One of the main difference is that pypy supports only R-Python, which
stands for 'Restricted Python".

Not true. PyPy is *written* in rpython. It runs standard Python.
 

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
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top