Re: What is Python's answer to Perl 6?

From: Reinhold Birkenfeld (reinhold-birkenfeld-nospam_at_wolke7.net)
Date: 10/30/04


Date: Sat, 30 Oct 2004 16:02:43 +0200

Jonathan Ellis wrote:
> A.M. Kuchling wrote:
>> The list of features for Python 3000 is described in PEP 3000,
>> appropriately enough:
>>
>> http://www.python.org/peps/pep-3000.html
>>
>> Most of the suggested changes remove redundancy, such as removing
>> now-unneeded built-in functions and language features.
>
> I'm sure this has been brought up before, but a quick google search
> didn't find anything on moving [has|get|set]attr into attributes of
> object. Why wouldn't this be considered a Good Thing? Just because
> Ruby people would like it? :)

You can take this step even further:

The builtin functions (that aren't doomed for py3k) can be classified in
those groups:

A. Constructors for built-in types

basestring, bool, complex, dict, file, float, int, list, long, object,
str, slice, tuple, type

These cannot be made attributes of some object.

B. Functions that can be attributed to some class or module

abs, divmod, round, pow -> math

ord -> str
In consequence: [uni]chr -> int
hex, oct -> int

super, *attr, isinstance, issubclass -> object

hash -> sys?

C. Functions that could be made attributes of lists/sequences

max, min, len, enumerate, sum

But that would require to implement them for all sequence types or
implement a common basetype 'seq'.

D. Other functions I cannot attribute to a class

eval
globals, locals, vars
iter
property
classmethod, staticmethod
cmp
[x]range
repr
__import__

Reinhold

-- 
[Windows ist wie] die Bahn: Man muss sich um nichts kuemmern, zahlt fuer
jede Kleinigkeit einen Aufpreis, der Service ist mies, Fremde koennen
jederzeit einsteigen, es ist unflexibel und zu allen anderen Verkehrs-
mitteln inkompatibel.               -- Florian Diesch in dcoulm


Relevant Pages

  • Re: parser needed
    ... static int tokenlen(const char *str, ... str - string containing expression ... ignores white space between tokens ...
    (comp.programming)
  • Re: Is anything easier to do in java than in lisp?
    ... In Linj you write: ... > argumentList in java. ... > int String.indexOf ... (position c str:from-end t) ...
    (comp.lang.lisp)
  • Re: Reading a string of unknown size
    ... replace above with int main ... '2 * sizeof *str'. ... failed to check the return value of mallocabove for failure. ... You've overwritten your earlier nul character. ...
    (comp.lang.c)
  • Re: Twinking a human paragon/wizard
    ... Con 14 ... Int 16 ... Cha 14 ... Str 8 ...
    (rec.games.frp.dnd)
  • Re: equivalent of chomp in perl
    ... int flushln{ ... resemblance to Perl's chomp function. ... chomp is used for a specific purpose, which is removing ... the newline from a whole line read from input. ...
    (comp.lang.c)