473,569 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python from Wise Guy's Viewpoint

THE GOOD:

1. pickle

2. simplicity and uniformity

3. big library (bigger would be even better)

THE BAD:

1. f(x,y,z) sucks. f x y z would be much easier to type (see Haskell)
90% of the code is function applictions. Why not make it convenient?

2. Statements vs Expressions business is very dumb. Try writing
a = if x :
y
else: z

3. no multimethods (why? Guido did not know Lisp, so he did not know
about them) You now have to suffer from visitor patterns, etc. like
lowly Java monkeys.

4. splintering of the language: you have the inefficient main language,
and you have a different dialect being developed that needs type
declarations. Why not allow type declarations in the main language
instead as an option (Lisp does it)

5. Why do you need "def" ? In Haskell, you'd write
square x = x * x

6. Requiring "return" is also dumb (see #5)

7. Syntax and semantics of "lambda" should be identical to
function definitions (for simplicity and uniformity)

8. Can you undefine a function, value, class or unimport a module?
(If the answer is no to any of these questions, Python is simply
not interactive enough)

9. Syntax for arrays is also bad [a (b c d) e f] would be better
than [a, b(c,d), e, f]

420

P.S. If someone can forward this to python-dev, you can probably save some
people a lot of soul-searching
Jul 18 '05
467 21278
Kenny Tilton wrote:

Lisp consistently errs on the side of more expressive power. The idea of
putting on a strait jacket while coding to protect us from ourselves
just seems batty. Similarly, a recent ex-C++ journal editor recently
wrote that test-driven development now gives him the code QA peace of
mind he once sought from strong static typing.
C++ is not the best example of strong static typing. It is a language
full of traps, which can't be detected by its type system.
An admitted former static typing bigot, he finished by wondering
aloud, "Will we all be coding in Python ten years from now?"

kenny


Best regards,
Tom

--
..signature: Too many levels of symbolic links
Jul 18 '05 #21

"Kenny Tilton" <kt*****@nyc.rr .com> wrote in message
news:_8******** ********@twiste r.nyc.rr.com...


Joachim Durchholz wrote:
Oh, you're trolling for an inter-language flame fest...
well, anyway:
3. no multimethods (why? Guido did not know Lisp, so he did not know
about them) You now have to suffer from visitor patterns, etc. like
lowly Java monkeys.

Multimethods suck.

The longer answer: Multimethods have modularity issues


Lisp consistently errs on the side of more expressive power. The idea of
putting on a strait jacket while coding to protect us from ourselves
just seems batty. Similarly, a recent ex-C++ journal editor recently
wrote that test-driven development now gives him the code QA peace of
mind he once sought from strong static typing. An admitted former static
typing bigot, he finished by wondering aloud, "Will we all be coding in
Python ten years from now?"

kenny


There was a nice example from one of the ILC 2003 talks about a Europian
Space Agency rocket exploding with a valueable payload. My understanding was
that there was testing, but maybe too much emphasis was placed the static
type checking of the language used to control the rocket. The end result was
a run time arithmetic overflow which the code intepreted as "rocket off
course". The rocket code instructions in this event were to self destruct.
It seems to me that the Agency would have fared better if they just used
Lisp - which has bignums - and relied more on regression suites and less on
the belief that static type checking systems would save the day.

I'd be interested in hearing more about this from someone who knows the
details.

-R. Scott McIntire
Jul 18 '05 #22
Frode Vatvedt Fjeld wrote:
John Thingstad <jo************ @chello.no> writes:
[..] Functions are internally delt with using dictionaies. The
Rather, _names_ are dealt that way (for globals; it's faster for
locals -- then, the compiler can turn the name into an index
into the table of locals' values), whether they're names of functions
or names of other values (Python doesn't separate those namespaces).
bytecode compiler gives it a ID and the look up is done using a
dictionary. Removing the function from the dictionary removes the
function. (pythonese for hash-table)
So to get from the ID to the bytecode, you go through a dictionary?


No; it's up to the implementation, but in CPython the id is the
memory address of the function object, so the bytecode's directly
accessed from there (well, there's a couple of indirectness --
function object to code object to code string -- nothing important).
And the mapping from name to ID happens perhaps when the caller is
bytecode-compiled?


No, it's a lookup. Dict lookup for globals, fast (index in table)
lookup for locals (making locals much faster to access), but a
lookup anyway. I've already posted about how psyco can optimize
this, being a specializing compiler, when it notices the dynamic
possibilities are not being used in a given case.
Alex
Jul 18 '05 #23

"Scott McIntire" <mc************ ******@comcast. net> wrote in message
news:MoEkb.8215 34$YN5.832338@s ccrnsc01...
There was a nice example from one of the ILC 2003 talks about a Europian Space Agency rocket exploding with a valueable payload. My understanding was that there was testing, but maybe too much emphasis was placed the static type checking of the language used to control the rocket. The end result was a run time arithmetic overflow which the code intepreted as "rocket off course". The rocket code instructions in this event were to self destruct. It seems to me that the Agency would have fared better if they just used Lisp - which has bignums - and relied more on regression suites and less on the belief that static type checking systems would save the day.

I'd be interested in hearing more about this from someone who knows the details.


I believe you are referring to the first flight of the Ariane 5
(sp?). The report of the investigating commission is on the web
somewhere and an interesting read. They identified about five
distinct errors. Try google.

Terry
Jul 18 '05 #24
Scott McIntire fed this fish to the penguins on Sunday 19 October 2003
15:39 pm:

There was a nice example from one of the ILC 2003 talks about a
Europian Space Agency rocket exploding with a valueable payload. My
understanding was that there was testing, but maybe too much emphasis
was placed the static type checking of the language used to control
the rocket. The end result was a run time arithmetic overflow which
the code intepreted as "rocket off course". The rocket code
instructions in this event were to self destruct. It seems to me that
the Agency would have fared better if they just used Lisp - which has
bignums - and relied more on regression suites and less on the belief
that static type checking systems would save the day.

I'd be interested in hearing more about this from someone who knows
the
details.
Just check the archives for comp.lang.ada and Ariane-5.

Short version: The software performed correctly, to specification
(including the failure mode) -- ON THE ARIANE 4 FOR WHICH IT WAS
DESIGNED.

The software was then dropped into the ARIANE 5 with NO REVIEW of
requirements. Two things were different -- the A-5 was capable of more
severe maneuvering, AND apparently the A-5 launch sequence did not need
this code to run for some 40 seconds after ignition (something about
the A-4 launch sequence allowed it to be aborted and restarted in the
40 second span, so the code had to keep up-to-date navigational fixes;
the A-5 OTOH is in space by that point, no post ignition holds).

On the A-4, any values that were that extreme were a sign of critical
malfunction and the software was to shutdown. Which is what it did on
the A-5. Of course, the backup computer then saw the same "malfunctio n"
and shut down too... For the A-4, you wouldn't WANT the computer to try
processing with those values that were so far out of performance specs
that the rocket had to be tumbling out of control anyways.

The bean-counters apparently did not allow the folks with the A-5
requirements to examine the A-4 code for compliance, and the A-4 Coders
obviously never knew about the A-5 performance specs.

LISP wouldn't have helped -- since the A-4 code was supposed to
failure with values that large... And would have done the same thing if
plugged in the A-5. (Or are you proposing that the A-4 code is supposed
to ignore a performance requirement?)

-- =============== =============== =============== =============== == <
wl*****@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
=============== =============== =============== =============== == <
Bestiaria Home Page: http://www.beastie.dm.net/ <
Home Page: http://www.dm.net/~wulfraed/ <


Jul 18 '05 #25


Dennis Lee Bieber wrote:
Scott McIntire fed this fish to the penguins on Sunday 19 October 2003
15:39 pm:

There was a nice example from one of the ILC 2003 talks about a
Europian Space Agency rocket exploding with a valueable payload. My
understandi ng was that there was testing, but maybe too much emphasis
was placed the static type checking of the language used to control
the rocket. The end result was a run time arithmetic overflow which
the code intepreted as "rocket off course". The rocket code
instruction s in this event were to self destruct. It seems to me that
the Agency would have fared better if they just used Lisp - which has
bignums - and relied more on regression suites and less on the belief
that static type checking systems would save the day.

I'd be interested in hearing more about this from someone who knows
the
details.

Just check the archives for comp.lang.ada and Ariane-5.

Short version: The software performed correctly, to specification
(including the failure mode) -- ON THE ARIANE 4 FOR WHICH IT WAS
DESIGNED.


Nonsense. From: http://www.sp.ph.ic.ac.uk/Cluster/report.html

"The internal SRI software exception was caused during execution of a
data conversion from 64-bit floating point to 16-bit signed integer
value. The floating point number which was converted had a value greater
than what could be represented by a 16-bit signed integer. This resulted
in an Operand Error. The data conversion instructions (in Ada code) were
not protected from causing an Operand Error, although other conversions
of comparable variables in the same place in the code were protected.
The error occurred in a part of the software that only performs
alignment of the strap-down inertial platform. This software module
computes meaningful results only before lift-off. As soon as the
launcher lifts off, this function serves no purpose."

LISP wouldn't have helped -- since the A-4 code was supposed to
failure with values that large... And would have done the same thing if
plugged in the A-5. (Or are you proposing that the A-4 code is supposed
to ignore a performance requirement?)
"supposed to" fail? chya. This was nothing more than an unhandled
exception crashing the sytem and its identical backup. Other conversions
were protected so they could handle things intelligently, this bad boy
went unguarded. Note also that the code functionality was pre-ignition
only, so there is no way they were thinking that a cool way to abort the
flight would be to leave a program exception unhandled.

What happened (aside from an unnecessary chunk of code running
increasing risk to no good end) is that the extra power of the A5 caused
oscillations greater than those seen in the A4. Those greater
oscillations took the 64-bit float beyond what would fit in the 16-bit
int. kablam. Operand Error. This is not a system saying "whoa, out of
range, abort".

As for Lisp not helping:
most-positive-fixnum ;; constant provided by implementation 536870911
(1+ most-positive-fixnum) ;; overflow fixnum type and... 536870912
(type-of (1+ most-positive-fixnum)) ;; ...auto bignum type BIGNUM
(round most-positive-single-float) ;; or floor or ceiling 340282346638528 859811704183484 516925440
0.0
(type-of *)

BIGNUM

kenny

--
http://tilton-technology.com
What?! You are a newbie and you haven't answered my:
http://alu.cliki.net/The%20Road%20to%20Lisp%20Survey

Jul 18 '05 #26
mi*****@ziplip. com wrote in message news:<LV******* *************** *************** *@ziplip.com>.. .
THE BAD:

1. f(x,y,z) sucks. f x y z would be much easier to type (see Haskell)
90% of the code is function applictions. Why not make it convenient?
Python has been designed to attract non-programmers as well. Don't
you think f(x,y,z) resembles the mathematical notation of passing
a function some parameters, instead of "f x y z"?
5. Why do you need "def" ? In Haskell, you'd write
square x = x * x
The reason is just to make it clearer that we're defining
a function. I wonder why you didn't complain about
the colons at the beginning of each block.. Some syntax is
there just to add readability. I suppose it means nothing
to you that Python is compared to executable pseudocode.
It means to Pythonistas.
6. Requiring "return" is also dumb (see #5)


You really don't get any of this "explicit is better than implicit"
thing, do you? Requiring people to write "return" instead of
leaving it as optional like in Ruby, is again one reason why
Pythonistas *like* Python instead of Ruby. You come to
a Python group (and cross-post this meaninglessly everywhere
even though it only concerns Pythonistas) claiming that the
features we like are dumb, and you wonder why people think
of you as a troll..

Anyway, as a conclusion, I believe you'd be much happier with
Ruby than with Python. It doesn't do this weird "statement vs
expression" business, it has optional return, it has optional
parens with function calls, and probably more of these things
"fixed" that you consider Python's downsides. You're trying to
make Python into a language that already exists, it seems, but
for some reason Pythonistas are happy with Python and not rapidly
converting to Ruby or Haskell. Instead of trying to tell us
what we like (and failing at that, as you can see), maybe you
should try to think for a while of why we like Python.

By the way, have you already posted a similar message
to comp.std.c++, saying what they should change about C++
to make it more like Haskell or Ruby? I'd love to read it
(it could be hilarious) ;)
Jul 18 '05 #27
Kenny Tilton <kt*****@nyc.rr .com> writes:
Dennis Lee Bieber wrote:
Just check the archives for comp.lang.ada and Ariane-5.

Short version: The software performed correctly, to specification
(including the failure mode) -- ON THE ARIANE 4 FOR WHICH IT WAS
DESIGNED.
Nonsense.


No, that is exactly right. Like the man said, read the archives for
comp.lang.ada.
From: http://www.sp.ph.ic.ac.uk/Cluster/report.html

"The internal SRI software exception was caused during execution of a
data conversion from 64-bit floating point to 16-bit signed integer
value. The floating point number which was converted had a value greater
than what could be represented by a 16-bit signed integer. This resulted
in an Operand Error. The data conversion instructions (in Ada code) were
not protected from causing an Operand Error, although other conversions
of comparable variables in the same place in the code were protected.
The error occurred in a part of the software that only performs
alignment of the strap-down inertial platform. This software module
computes meaningful results only before lift-off. As soon as the
launcher lifts off, this function serves no purpose."


That's all true, but it is only part of the story, and selectively quoting
just that part is misleading in this context.

For a more detailed answer, see
<http://www.google.com. au/groups?as_umsgi d=359BFC60.446B %40lanl.gov>.
LISP wouldn't have helped -- since the A-4 code was supposed to
failure with values that large... And would have done the same thing if
plugged in the A-5. (Or are you proposing that the A-4 code is supposed
to ignore a performance requirement?)


"supposed to" fail? chya. This was nothing more than an unhandled
exception crashing the sytem and its identical backup. Other conversions
were protected so they could handle things intelligently, this bad boy
went unguarded.


The reason that it went unguarded is that the programmers DELIBERATELY
omitted an exception handler for it. The post at the URL quoted above
explains why.

--
Fergus Henderson <fj*@cs.mu.oz.a u> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
Jul 18 '05 #28
mi*****@ziplip. com wrote in
news:LV******** *************** *************** @ziplip.com:
1. f(x,y,z) sucks. f x y z would be much easier to type (see Haskell)
90% of the code is function applictions. Why not make it convenient?


What syntax do you propose to use for f(x(y,z)), or f(x(y(z))), or
f(x,y(z)) or f(x(y),z) or f(x)(y)(z) or numerous other variants which are
not currently ambiguous?

--
Duncan Booth du****@rcp.co.u k
int month(char *p){return(1248 64/((p[0]+p[1]-p[2]&0x1f)+1)%12 )["\5\x8\3"
"\6\7\xb\1\x9\x a\2\0\4"];} // Who said my code was obscure?
Jul 18 '05 #29
Duncan Booth wrote:
mi*****@ziplip. com wrote in
news:LV******** *************** *************** @ziplip.com:
1. f(x,y,z) sucks. f x y z would be much easier to type (see Haskell)
90% of the code is function applictions. Why not make it convenient?


What syntax do you propose to use for f(x(y,z)), or f(x(y(z))), or
f(x,y(z)) or f(x(y),z) or f(x)(y)(z) or numerous other variants which are
not currently ambiguous?


Haskell has it easy -- f x y z is the same as ((f x) y) z -- as an
N-ary function is "conceptualized " as a unary function that returns
an (N-1)-ary function [as Haskell Curry conceptualized it -- which
is why the language is named Haskell, and the concept currying:-)].
So, your 5th case, f(x)(y)(z), would be exactly the same thing.

When you want to apply operators in other than their normal order
of priority, then and only then you must use parentheses, e.g. for
your various cases they would be f (x y z) [1st case], f (x (y z))
[2nd case], f x (y z) [3rd case], f (x y) z [4th case]. You CAN,
if you wish, add redundant parentheses, of course, just like in
Python [where parentheses are overloaded to mean: function call,
class inheritance, function definition, empty tuples, tuples in
list comprehensions, apply operators with specified priority --
I hope I recalled them all;-)].

Of course this will never happen in Python, as it would break all
backwards compatibility. And I doubt it could sensibly happen in
any "simil-Python" without adopting many other Haskell ideas, such
as implicit currying and nonstrictness. What "x = f" should mean
in a language with assignment, everything first-class, and implicit
rather than explicit calling, is quite troublesome too.

Ruby allows some calls without parentheses, but the way it disambiguates
"f x y" between f(x(y)) and f(x, y) is, IMHO, pricey -- it has to KNOW
whether x is a method, and if it is it won't just let you pass it as such
as an argument to f; that's the slippery slope whereby you end up having to
write x.call(y) because not just any object is callable.
"x = f" CALLS f if f is a method, so you can't just treat methods
as first-class citizens like any other... etc, etc...
AND good Ruby texts recommend AVOIDING "f x y" without parentheses,
anyway, because it's ambiguous to a human reader, even when it's
clear to the compiler -- so the benefit you get for that price is
dubious indeed.
Alex

Jul 18 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

75
4607
by: Xah Lee | last post by:
http://python.org/doc/2.4.1/lib/module-re.html http://python.org/doc/2.4.1/lib/node114.html --------- QUOTE The module defines several functions, constants, and an exception. Some of the functions are simplified versions of the full featured methods for compiled regular expressions. Most non-trivial applications always use the compiled...
6
2364
by: Juha S. | last post by:
Hi, I'm writing a small text editor type application with Python 2.5 and Tkinter. I'm using the Tk text widget for input and output, and the problem is that when I try to save its contents to a .txt file, any Scandinavian letters such as "äöå ÄÖÅ" are saved incorrectly and show up as a mess when I open the .txt file in Windows Notepad. ...
4
2453
by: Berco Beute | last post by:
I wonder what it would take to implement Python in JavaScript so it can run on those fancy new JavaScript VM's such as Chrome's V8 or Firefox' tracemonkey. Much the same as Python implementations in C# (IronPython) and Java (Jython). It would certainly bring back the fun in web application development. Is there anything done in that...
0
1160
by: Luke Kenneth Casson Leighton | last post by:
On Sep 3, 10:02 pm, bearophileH...@lycos.com wrote: 1200 lines of code for the compiler, and about... 800 for a basic suite of builtin types (Dict, List, set, string). http://pyjamas.sf.net so it's been done.
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.