473,320 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

My own 12 points list

I have really no mayor gripes, and the few things I would change would
break backward compatibility, but here is the list anyway:

1.) Eliminate the whole long stuff. E.g. built-in long () function,
"L", etc. It is a Python language implementation detail and I do not
care about how it is done as long as it is fast and correct. Make
python int adapt according to size of the integer and underlying
architecture. 8088-80286=16 bit integers, 386-586=32
bit, x86-64=64bit. If number overflows the CPU architecture
auto-magically use internal (long) representation.

2.) Eliminate map (), filter (), reduce (). It can be replaced with
list comprehensions and for loops, which are easier to read.

3.) Eliminate open (), use file () instead

4.) Eliminate xrange(), replace range() with xrange() implementation

5.) Eliminate built-in functions buffer(), callable(), delattr(),
dir(), getattr(), hasattr(), hash(), help(), id(), isinstance(),
len(), max(), min(), repr(), setattr(), sum(), str(), type(),
unichr() and make them methods of the root or base object. Transform
them into object.func(parameters). Most of them have as the first
parameter an object anyway. Some of them can be moved to sys. Various
other functions can be deprecated so that I do no have to scan over a
dozen of functions each time I am looking something up. Especially if
few people use them anyway and they can be replaced 1:1 with another
simple construct.

6.) Eliminate lambda, use local ‘def somename(param):return expr'
instead.

7.) Eliminate locals(), globals() and replace with a vars() that
defaults to locals, and accept a parameter to get globals().

8.) Eliminate `x` for repr()

9.) Eliminate raw_input() and replace input() with raw_input()
implementation. Input can be done using eval(input()). Do NOT simply
eliminate input, print and put it in sys. Although it IS ugly, reading
and writing to standard input and output is the bread and butter of
admin scripts, CGI and all kinds of glue programs (python's core
usage) and should be readily available. It also makes for a quick and
dirty user input and output for debugging. sys.stdin.readline() is too
verbose IMHO.

10.) Eliminate the recursion limit on functions or better yet, include
an option to change from the default to infinite. No need to change
anything in the language. A lot of work in the implementation though.
Could use regular method up to a number of calls and then switch to a
less performant method.

11.) Add a big decimal type (something like java) in the standard
library. To be able to do bean counter type math easily. Are there so
few python applications that deal with money?

12.) Int division: return float (for engineers) or big decimal (for
bean counters)

Some of them are blatantly copied from Guidos regrets slides btw. I
just happen to agree with most of the points on them.

Nestor
Jul 18 '05 #1
6 1724
pr*******@latinmail.com (nnes) wrote...
8.) Eliminate `x` for repr()
I have a different idea for backticks use: something like `foo` in
Unix shells. It would behave more or less like popen("foo"), just a
bit smarter. You could either:
print `ls`
and get the whole output of /bin/ls

- or -
for line in `ls` .... print line

and read output of /bin/ls line by line.

I would add other behavior of string types, like % formatting, so you
could do:
print `ls %s %s` % ('-a', '*foo*')


One potential problem is closing the underlying popen() object early
enough. And it's not really a big advantage over popen() either.
11.) Add a big decimal type (something like java) in the standard
library. To be able to do bean counter type math easily. Are there so
few python applications that deal with money?
I second that. We already have unlimited longs, but with floats we're
limited to platform-specific values.
12.) Int division: return float (for engineers) or big decimal (for
bean counters)


Rational type also fits here to some extent. I wouldn't make it part
of the language though, but rather a standard library type,
rational(a, b=1).

AdSR
Jul 18 '05 #2
pr*******@latinmail.com (nnes) writes:
I have really no mayor gripes, and the few things I would change would
break backward compatibility, but here is the list anyway:

1.) Eliminate the whole long stuff. E.g. built-in long () function,
"L", etc. It is a Python language implementation detail and I do not
care about how it is done as long as it is fast and correct. Make
python int adapt according to size of the integer and underlying
architecture. 8088-80286=16 bit integers, 386-586=32
bit, x86-64=64bit. If number overflows the CPU architecture
auto-magically use internal (long) representation.
In progress. See PEP 217.
2.) Eliminate map (), filter (), reduce (). It can be replaced with
list comprehensions and for loops, which are easier to read.
I'm wary of "eliminate" -- why break old code for no very good reason?
"discourage", maybe.
3.) Eliminate open (), use file () instead
Hmm. I think "open" reads better, myself.
4.) Eliminate xrange(), replace range() with xrange() implementation
Backward compatibility again: some code really does expect to get a
list out of range(). But there are signs things are nudging in this
direction, slowly.
5.) Eliminate built-in functions buffer(), callable(), delattr(),
dir(), getattr(), hasattr(), hash(), help(), id(), isinstance(),
len(), max(), min(), repr(), setattr(), sum(), str(), type(),
unichr() and make them methods of the root or base object.
Ye gods, no. This would be pure churn. And I'm not sure it's even a
good idea for some of those listed.
6.) Eliminate lambda, use local ‘def somename(param):return expr'
instead.
With you here, modulo the usual "eliminate" concern.
7.) Eliminate locals(), globals() and replace with a vars() that
defaults to locals, and accept a parameter to get globals().
Why?

[...] 10.) Eliminate the recursion limit on functions or better yet, include
an option to change from the default to infinite. No need to change
anything in the language. A lot of work in the implementation though.
Could use regular method up to a number of calls and then switch to a
less performant method.
See www.stackless.com :-)
11.) Add a big decimal type (something like java) in the standard
library. To be able to do bean counter type math easily. Are there so
few python applications that deal with money?
Again, there is movement here.
12.) Int division: return float (for engineers) or big decimal (for
bean counters)
I really don't like the idea of having optional behaviour here.
Some of them are blatantly copied from Guidos regrets slides btw. I
just happen to agree with most of the points on them.


I thought some of them looked familiar :-)

----

There's a distinction between "how would I do things if I could go
back to the early 1990s and have a chat with Guido" and "what changes
are worth making now". There's a price to any change (esp. ones like
"eliminate open()"...) and I think my limit may be set a little lower
than yours :-)

Cheers,
mwh

--
ARTHUR: Why are there three of you?
LINTILLAS: Why is there only one of you?
ARTHUR: Er... Could I have notice of that question?
-- The Hitch-Hikers Guide to the Galaxy, Episode 11
Jul 18 '05 #3
pr*******@latinmail.com (nnes) wrote in message news:<d8**************************@posting.google. com>...
I have really no mayor gripes, and the few things I would change would
break backward compatibility, but here is the list anyway:

2.) Eliminate map (), filter (), reduce (). It can be replaced with
list comprehensions and for loops, which are easier to read.
How do you pass a list comprehension to a function? With map
as a function, you could do something wicked like

do_something_wicked([map, my_map, his_map])

Where my_map and his_map are alternative implementations for
map, and do_something_wicked would use all those functions
for something crazy. But sure, map could be implemented with
list comprehensions if it was really needed, probably like this:

def map(fn, *lists):
return [fn(*args) for args in zip(*lists)]

Soo.. Do I have an optinion? Maybe, maybe not.. I just wanted
to point out that some things are useful as being functions
instead of plain syntax.
4.) Eliminate xrange(), replace range() with xrange() implementation
Then people would have to use list(range[10]) to get the list when
needed.. I always use range() since Psyco seems to optimize it
to a simple for loop of integers (on my tests with Psyco,
"for x in range(n)" is -faster- than "for x in xrange(n)"!).
So xrange() could be removed, and then people would just rely
on JIT compiler optimizations to do the right thing.
Maybe not yet though.
6.) Eliminate lambda, use local ?def somename(param):return expr'
instead.


Noo, lambda is so lovely and compact. It only obfuscates on
the purposedly obfuscated code. It's too long word for my taste
though.. A symbol for it would be better (I'm not joking).
Jul 18 '05 #4
A. Lloyd Flanagan:
open() is deprecated [in favor of 'file'], I don't know about plans
to eliminate it.


I think formally speaking it isn't deprecated. The docs say open
is "An alias for the file() function"

http://www.python.org/doc/2.3/lib/built-in-funcs.html
Andrew
da***@dalkescientific.com
Jul 18 '05 #5
A. Lloyd Flanagan wrote:
pr*******@latinmail.com (nnes) wrote in message news:<d8**************************@posting.google. com>...
I have really no mayor gripes, and the few things I would change would
break backward compatibility, but here is the list anyway:

3.) Eliminate open (), use file () instead

open() is deprecated, I don't know about plans to eliminate it.


Doesn't 'deprecated' mean it will once be elimineted?
5.) Eliminate built-in functions buffer(), callable(), delattr(),
dir(), getattr(), hasattr(), hash(), help(), id(), isinstance(),
len(), max(), min(), repr(), setattr(), sum(), str(), type(),

Many of these are being superseded by object meathods. I don't know
about eliminating them; you'd break nearly every old program.


Python 3.0...?

Gerrit.

--
173. If this woman bear sons to her second husband, in the place to
which she went, and then die, her earlier and later sons shall divide the
dowry between them.
-- 1780 BC, Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
http://www.sp.nl/

Jul 18 '05 #6
Gerrit Holl wrote:

A. Lloyd Flanagan wrote:
pr*******@latinmail.com (nnes) wrote in message news:<d8**************************@posting.google. com>...
I have really no mayor gripes, and the few things I would change would
break backward compatibility, but here is the list anyway:

3.) Eliminate open (), use file () instead

open() is deprecated, I don't know about plans to eliminate it.


Doesn't 'deprecated' mean it will once be elimineted?


It doesn't mean "will be", but usually means "might be". Nobody,
except Guido with the time machine of course, can predict the
future, so it expresses only intent. And sometimes a thing can
be deprecated (as in "don't use this in new code") without anyone
actually planning to eliminate it, ever.

-Peter
Jul 18 '05 #7

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

Similar topics

2
by: Martin Magnusson | last post by:
Hi I'm traversing a std::list backwards with a reverse_iterator, and need to check for the case when the iterator points to the first element of the list. My code now looks something like the...
1
by: David Bradbury | last post by:
I may be thinking about this the wrong way, but here goes: In my style sheet I've specified that bullet points should use a specific image rather than just be default bullet points. However, at...
5
by: Mark Lancaster | last post by:
I have a routine that calculates time vs temperature for a process. It generates x,y points that I need to plot. The number of points to be plotted varies, so I want to dynamically build the list...
3
by: acosgaya | last post by:
Hi, I would like some help as how to approach the following problem: I have a set of d-dimensional points (e.g (3,5,8,9,5) is a 5-dimensional point), and I need to sort the points on each of the...
12
by: erikcw | last post by:
Hi all, I have a collection of ordered numerical data in a list. The numbers when plotted on a line chart make a low-high-low-high-high-low (random) pattern. I need an algorithm to extract the...
9
by: Eric.Gabrielson | last post by:
Hello, I am very knew to python and am attempting to write a program in python that a friend of mine is having to write in java. I am doing this for fun and would like some help as to how i can...
4
by: shortyes | last post by:
Is there any easy way to sort a list of Points by either its X or Y or both? Tried sortedlist (of String, Point) where string is Point.X & "," & Point.Y as the key sortedlist (of Point, Point)...
9
by: ECUweb | last post by:
Hi, I need to sort out a list of records based on the field "Weight" and then allocate points (from 1 to 10) to each record (in another field "Points") depending on the position of the record in the...
1
by: psbasha | last post by:
Hi , I have a list of points and I have to find the boundary nodes from the points. For example : pointList = ,,,,] How to sort the coordinate values in the list based on X:Xmin,Xmax ...
3
by: raylopez99 | last post by:
I'm wondering, since my program uses a lot of mouse points when the mouse is moving, but for resolution purposes doesn't really need to collect so many mouse points, is it conventional to use a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.