Python Success stories

P

Paul Hankin

Sure. Python is more readable than Perl, though I have found Python
to have a weird behavior regarding this little issue :

How can you explain that Python doesn't support the ++ opeator,
whereas at the same time it does support the += operator ???

No python developer I know has been able to answer that.

Because ++ is of limited use and has poor readability?

'x++' vs 'x += 1' saves 3 characters and is less readable.

'my_long_variable += expression' vs 'my_long_variable =
my_long_variable + expression' saves a lot of characters and is more
readable, because it avoids the duplication of the variable name. When
my_long_variable is a more complex term (perhaps
my_long_variable[some_long_expression]) it's even better.

Plus you get the useful update-in-place behaviour when the left-hand-
side of the += expression is a list.
 
C

Carl Banks

Sure. Python is more readable than Perl, though I have found Python
to have a weird behavior regarding this little issue :

How can you explain that Python doesn't support the ++ opeator,
whereas at the same time it does support the += operator ???


Because "Features A and B are in language X. Python adds Feature A.
Therefore Python must also add Feature B (or it'll be weird)" is not
valid logic.


Carl Banks
 
G

Gabriel Genellina

Sure. Python is more readable than Perl, though I have found Python
to have a weird behavior regarding this little issue :

How can you explain that Python doesn't support the ++ opeator,
whereas at the same time it does support the += operator ???

No python developer I know has been able to answer that.

Because Python doesn't follow the "boxed variables" model. In other languages i++ changes the "value" stored inside the box "i", but the box itself (the variable) is still the same. Python doesn't have boxes, it has names that refer to objects. For all builtin numeric types, i += 1 creates a *new* object with the resulting value and makes the name "i" refer to this new object.
i++ would be confusing because it looks like a mutating operation over i, but in fact it would be an assignment.
 
M

Mike Hansen

Hy guys,
A friend of mine i a proud PERL developer which always keeps making
jokes on python's cost.

Please give me any arguments to cut him down about his commnets
like :"keep programing i python. maybe, one day, you will be able to
program in VisualBasic"

This hurts. Please give me informations about realy famous
aplications.

Sage ( http://www.sagemath.org ) is a pretty large Python computer
algebra system ( about 150,000 unique lines of Python and 75,000
unique lines of Cython as a rough estimate). Python turned out to be
an _excellent_ language do this in since it allows for quick
development time for many things that aren't speed dependent while
allowing a seemless transition to fast code with Cython.

--Mike
 
S

Steve Holden

azrael said:
Hy guys,
A friend of mine i a proud PERL developer which always keeps making
jokes on python's cost.

Please give me any arguments to cut him down about his commnets
like :"keep programing i python. maybe, one day, you will be able to
program in VisualBasic"

This hurts. Please give me informations about realy famous
aplications.
Ask him why, if Perl is so great, it isn't one of the Google-approved
languages for internal use, when Python *is*.

Ask him how it feels to program in a wrote-only language.

Challenge him to a dual with dead kippers at twenty paces.

regards
Steve
 
S

Steve Holden

Nikita said:
Why are either of you so emotionally attached to the tools you use?

I don't know your friend, but my guess is that he's not interested in a
logical argument, so he won't be impressed even if you claim that God
himself wrote the Universe in Python. I think he enjoys saying this
stuff simply because you react to it. It's pretty sad that he can't find
something better to do with his time.
It's even sadder that he doesn't need to.

[...]
regards
Steve
 
S

Steve Holden

Nikita said:
Why are either of you so emotionally attached to the tools you use?

I don't know your friend, but my guess is that he's not interested in a
logical argument, so he won't be impressed even if you claim that God
himself wrote the Universe in Python. I think he enjoys saying this
stuff simply because you react to it. It's pretty sad that he can't find
something better to do with his time.
It's even sadder that he doesn't need to.

[...]
regards
Steve
 
S

Steve Holden

Ben said:
Please, have some dignity!

Challenge him to a duel with live kippers. Live, *rabid* kippers. With
frickin' laser beams on their heads.
I like your style.

Though considering what it takes to kipper a herring, I'd be very
surprised if there *was* any such thing as a live kipper. With or
without laser beam.

regards
Steve
 
M

Mark Wooding

Gabriel Genellina said:
Because Python doesn't follow the "boxed variables" model.

Be careful here. `Boxed types' or `boxed objects' is a technical term
essentially meaning `heap-allocated objects, probably with reference
semantics', which Python most definitely does use -- so this almost
means the opposite of what you're talking about.

Python has the same basic data model as Lisp, Ruby, Smalltalk and many
other languages: a variable (or a `slot' in a compound data-object)
contains a reference to value; values can referred to by many variables.
Assignment simply copies these references around. This means that it's
easy to end up sharing the same object between lots of variables (or
structures).

Contrast this to the model used by C, Pascal and other `traditional'
compiled languages, where a variable is actually a container for a
value, and assignment is a copying operation rather than a sharing
operation.
In other languages i++ changes the "value" stored inside the box "i",
but the box itself (the variable) is still the same. Python doesn't
have boxes, it has names that refer to objects. For all builtin
numeric types, i += 1 creates a *new* object with the resulting value
and makes the name "i" refer to this new object.

Note that `+=' in Python is inconsistent! For numeric types (and other
immutable types, such as strings or tuples), `VAR += VALUE' means the
same thing as `VAR = VAR + VALUE' (ignoring tedious issues of multiple
evaluation of subexpressions -- e.g., subscripts -- in VAR), which as
mentioned above causes a new reference to be stored in VAR, referring to
the object which was computed by adding VALUE to the object previously
referred to by VAR. For lists, it does not do this: instead, it extends
the list in place, putting new values on the end of it.

(This is one of the language's few obvious inconsistencies, and probably
a reasonably justifiable one; but it's still worth pointing out.)

To be honest, I don't see any particular reason why `++' is any more of
a mutation operation than `+=' is in the languages that define it;
Python is actually one of the few to define one but not the other. (The
other one I can think of is Acorn's BBC BASIC, for whatever that's
worth; it too lacks `++'.) But then again, one of the main conceptual
advantages of `++' as an operator is that it has both pre- and post-
increment variants, which are useful when used as part of a wider
expression. This won't hold in Python, since assignments (which `++'
assuredly ought to be) aren't allowed as subexpressions anyway. So the
value of `++' would be limited to providing an abbreviation over the
already quite short `+= 1'.

That's not quite true, in fact: it might be useful to define other kinds
of incrementing for specialist types, but I can't think of any obvious
examples off the top of my head.

This argument doesn't apply to `+=' which has the benefit of saving you
from having to type the VAR twice (which is nontrivial if VAR contains
complex subexpressions) and -- more significantly -- saves a reader from
having to check whether VAR and VAR' actually match in `VAR = VAR' +
VALUE' and ensures only single evaluation of subexpressions of VAR.
None of this applies to `++'. So `++' is not a feature I find myself
sorely missing in Python.

-- [mdw]
 
P

Philipp Pagel

azrael said:
A friend of mine i a proud PERL developer which always keeps making
jokes on python's cost.

There is only one sane way to deal with this situation: You need a
common enemy. Java comes to mind ;-)

cu
Philipp
 
P

Paul Boddie

Be careful here. `Boxed types' or `boxed objects' is a technical term
essentially meaning `heap-allocated objects, probably with reference
semantics', which Python most definitely does use -- so this almost
means the opposite of what you're talking about.

I think Gabriel meant "variables as boxes" - the classic description
of variables in "old school" programming languages, which is in
contrast to the "variables as labels" model used by Python.

[...]
This won't hold in Python, since assignments (which `++'
assuredly ought to be) aren't allowed as subexpressions anyway.

This syntactic note is probably one of the biggest arguments against
it, yes, since many of the benefits it has in C would be absent in
Python.

[...]
That's not quite true, in fact: it might be useful to define other kinds
of incrementing for specialist types, but I can't think of any obvious
examples off the top of my head.

Well, as I recall, data structures in C++ (such as iterators) often
use the pre/post-increment/decrement operators as shorthand, arguably
reflecting the "pointer arithmetic" heritage of the C family of
languages. It would be pure sugar in Python, though.

Paul
 
R

Reedick, Andrew

-----Original Message-----
From: [email protected] [mailto:python-
[email protected]] On Behalf Of azrael
Sent: Tuesday, April 22, 2008 6:26 AM
To: (e-mail address removed)
Subject: Python Success stories

Hy guys,
A friend of mine i a proud PERL developer which always keeps making
jokes on python's cost.

Please give me any arguments to cut him down about his commnets
like :"keep programing i python. maybe, one day, you will be able to
program in VisualBasic"

This hurts. Please give me informations about realy famous
aplications.


IIRC, Python is used in games like Eve Online (SciFi MMO) and Vampire:
Bloodlines (RPG.) Years later, a dedicated fan is still fixing/updating
the Bloodlines python scripts that control the dialogue and scripted
events.

OTOH, I use Perl over Python when it comes to Windows COM scripts due to
finding a typelib that Python just refused to load. *shrug*

Perl, Python, and your friend are tools. Use them appropriately for the
given situation.
 
C

Cristina Yenyxe González García

2008/4/23 said:
IIRC, Python is used in games like Eve Online (SciFi MMO) and Vampire:
Bloodlines (RPG.) Years later, a dedicated fan is still fixing/updating
the Bloodlines python scripts that control the dialogue and scripted
events.

Now that you mention it, Python was also used in the Star Wars:
Knights of the Old Republic (KotOR) saga. You can even search the
scripts across the disc and take a look at hilarious code comments
like "this works but I don't know why" :D
 
C

cokofreedom

Civilisation 4 uses Python everywhere and is the main tool used by
Modders of the game.
 
B

Bob Woodham

Because ++ is of limited use and has poor readability?

'x++' vs 'x += 1' saves 3 characters and is less readable.

In addition, the statement

x = x++;

has unspecified behaviour in C. That is, it is not specified
whether the value of x after execution of the statement is the
old value of x or one plus the old value of x.
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top