473,769 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prothon Prototypes vs Python Classes

Playing with Prothon today, I am fascinated by the idea of eliminating
classes in Python. I'm trying to figure out what fundamental benefit
there is to having classes. Is all this complexity unecessary?

Here is an example of a Python class with all three types of methods
(instance, static, and class methods).

# Example from Ch.23, p.381-2 of Learning Python, 2nd ed.

class Multi:
numInstances = 0
def __init__(self):
Multi.numInstan ces += 1
def printNumInstanc es():
print "Number of Instances:", Multi.numInstan ces
printNumInstanc es = staticmethod(pr intNumInstances )
def cmeth(cls, x):
print cls, x
cmeth = classmethod(cme th)

a = Multi(); b = Multi(); c = Multi()

Multi.printNumI nstances()
a.printNumInsta nces()

Multi.cmeth(5)
b.cmeth(6)
Here is the translation to Prothon.

Multi = Object()
with Multi:
.numInstances = 0
def .__init__(): # instance method
Multi.numInstan ces += 1
def .printNumInstan ces(): # static method
print "Number of Instances:", Multi.numInstan ces
def .cmeth(x): # class method
print Multi, x

a = Multi(); b = Multi(); c = Multi()

Multi.printNumI nstances()
a.printNumInsta nces()

Multi.cmeth(5)
b.cmeth(6)
Note the elimination of 'self' in these methods. This is not just a
syntactic shortcut (substiting '.' for 'self') By eliminating this
explicit passing of the self object, Prothon makes all method forms
the same and eliminates a lot of complexity. It's beginning to look
like the complexity of Python classes is unecessary.

My question for the Python experts is -- What user benefit are we
missing if we eliminate classes?

-- Dave

Jul 18 '05
145 6363
Michael wrote:
If you're making a short response to the entire message it's okay to top
post.


I wouldn't consider it appropriate even then. In that situation
I usually pick some distinctive sentence from the original and
quote that -- just to remind people of the context, not to
reproduce it in toto.

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg

Jul 18 '05 #101
On Tue, 30 Mar 2004 22:40:34 -0700, Hamilcar Barca wrote:
top-posting doesn't follow the rules of written European language.


I don't know why you feel the need to qualify that; I don't know of
*any* human writing system in current use where a discussion proceeds
from the bottom to the top. So:

top-posting doesn't follow the rules of written language.

seems stronger to me.

--
\ "When I turned two I was really anxious, because I'd doubled my |
`\ age in a year. I thought, if this keeps up, by the time I'm six |
_o__) I'll be ninety." -- Steven Wright |
Ben Finney <http://bignose.squidly .org/>
Jul 18 '05 #102
I just downloaded it. I'll give it a try.

"JanC" <us*********@ja nc.invalid> wrote in message
news:Xn******** **********@213. 119.4.35...
"Mark Hahn" <ma**@prothon.o rg> schreef:
I really really try to remember to quote from below. If you go through my posts you will see that I remember most of the time. The last few days I
have been reponding to four or five mailing lists after months of only
coding and my fingers are worn out.


Try OE-QuoteFix, it can help you, and it's free:
<http://home.in.tum.de/~jain/software/oe-quotefix/>

Also, I think OE allows you to select the text-to-quote _before_ replying.

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9

Jul 18 '05 #103
Bruno Desthuilliers wrote:
Peter Hickman wrote:
People who whine on about 'top posting' are the sort of people who
draft 'clean desk' policies. If you want to whine about top posting
then start alt.whine.top.p osting and have fun.

That is not quite right. Using top posting forces every reader to
unlearn a lifetime of knowledge about narrative flow in content.

Left-right - top-down

That's how we are reading and writing in most western cultures. For me
that's about 40 years of habbit. And it takes a lot of mental effort to
read.

You could just as well expect that we start reading from right to left.
Exactly the same thing.

..too confusing pretty is that And
regards Max M
Jul 18 '05 #104
top.
to
bottom
read
to
learn
to
you
forcing
be
would
this
No,
That is not quite right. Using top posting forces every reader to
unlearn a lifetime of knowledge about narrative flow in content.

Left-right - top-down

That's how we are reading and writing in most western cultures. For me
that's about 40 years of habbit. And it takes a lot of mental effort
to read.

You could just as well expect that we start reading from right to
left. Exactly the same thing.

.too confusing pretty is that And


With top posting you're still reading the same way. You shouldn't even
need to read the quoted text below. It's only there to help keep the
structure of the conversation recorded. You read the relevant parts of a
document first and since we are, as you said, used to reading top-down
that means the relevant parts are highest on the page. The same way we
read a title and opening paragraph before reading the rest of a document.

Jul 18 '05 #105
Max M wrote:
Peter Hickman wrote:
People who whine on about 'top posting' are the sort of people who
draft 'clean desk' policies. If you want to whine about top posting
then start alt.whine.top.p osting and have fun.


That is not quite right. Using top posting forces every reader to
unlearn a lifetime of knowledge about narrative flow in content.


(ages since I jumped into a troll... :-)

What against-top-posting people do not WANT to understand is that the very first
interest of posting is, to me, to get help or information.

So, you post your question and, by definition, you remember what it was (well, I
hope so).

Then, you go back to the ng the day after and if you got an answer, you are
interested in the answer, not to reread your post.

I do not read answers to questions I did not post, so I don't care about
"unlearn a lifetime of knowledge about narrative flow in content".

Period.

But as I try to be a gentleman, I did not top-post my post :-)

D.
Toulouse
Auto elected President of the Top Posting Liberation Army

Jul 18 '05 #106
Michael wrote:
With top posting you're still reading the same way. You shouldn't even
need to read the quoted text below.
Then why waste space and bandwidth and include it?
It's only there to help keep the
structure of the conversation recorded.


If you need to refresh your memory on the discussion then back up the
thread and read the previous messages. A whole keypress in most readers.

And that's saying nothing of rendering the information that's given by
the line count of the posting useless. Many readers display the line
count with the subject, and that gives you a clue as to how 'heavy' the
posting is going to be. Just a short rebuttal, a 'me too', or a
dissertation in it's own right? It's impossible to tell when people
include the particular version of the King James' bible they're
commenting on.

As I'm against capital punishement; twentyfive to life for top-posters,
I say.

Stefan,
--
Stefan Axelsson (email at http://www.cs.chalmers.se/~sax)
Jul 18 '05 #107
Then why waste space and bandwidth and include it?
Because it provides contunity?
If you need to refresh your memory on the discussion then back up the
thread and read the previous messages. A whole keypress in most readers.
Which is fine except that often threads go in mupltiple directions and
have multiple people conversing such that without quoted text a reader
may be unsure what and who was being responded to.
And that's saying nothing of rendering the information that's given by
the line count of the posting useless. Many readers display the line
count with the subject, and that gives you a clue as to how 'heavy'
the posting is going to be. Just a short rebuttal, a 'me too', or a
dissertation in it's own right? It's impossible to tell when people
include the particular version of the King James' bible they're
commenting on.


Which is why it's helpful to clip your quoted material to what is needed
to be informative and that is all. It might be a good feature if you
made an option in your mail program not to count quoted lines. Should't
be to hard to implement.

Jul 18 '05 #108
>>>>> "Didier" == Didier Morandi <no@spam.com> writes:

Didier> I do not read answers to questions I did not post, so I don't care
Didier> about "unlearn a lifetime of knowledge about narrative flow in
Didier> content".

So essentially Usenet should be a free Q&A automaton, where people
post questions and Usenet fairies go around answering them? Everybody
takes, nobody gives? I believe such service should cost you money...

Note that many read the newsgroup w/o having any questions of their
own, perhaps wanting to learn from the questions of others or see if
there is some interesting discussion going on. Top posting kills all
that.

It surprises me how much flammage people need before correcting the
error of their ways these days. Top posting might be forgivable for a
newbie/grandmother who is just trying his hand w/ Usenet for the first
time, but repeat offenders should be reprimanded.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #109
On Wed, Mar 31, 2004 at 12:30:23PM +0200, Didier Morandi wrote:
Max M wrote:
That is not quite right. Using top posting forces every reader to
unlearn a lifetime of knowledge about narrative flow in content.
(ages since I jumped into a troll... :-)

What against-top-posting people do not WANT to understand is that the very
first interest of posting is, to me, to get help or information.


My mail reader (I'm using the mailing-list gateway for comp.lang.pytho n, but
this applies equally well to usenet readers) highlights quoted and
non-quoted text in different colours (in case the ">" aren't distinctive
enough already for you!). I find my eye jumps directly to the fresh text
just fine, *and* when people snip text and bottom-post, I still get a
coherent, sensible, intuitively-ordered view of the conversation (not to
mention a seperate pane showing this messages position in the overall
thread).

It's the best of both worlds, but it's ruined by top-posters.
So, you post your question and, by definition, you remember what it was
(well, I hope so).

Then, you go back to the ng the day after and if you got an answer, you are
interested in the answer, not to reread your post.
One of the great features of newsgroups (and mailing-lists) is their ability
to support multiple concurrent conversations -- and that's just within a
single group/list. I subscribe to a lot of mailing lists. It's nice to
have a contextual reminder of what the thing you're reading right now was
related to.

You are also presupposing a very limited question-answer format for usenet,
which is certainly not the only form of communication I see here.
I do not read answers to questions I did not post, so I don't care about
"unlearn a lifetime of knowledge about narrative flow in content".

Period.


Then why are you reading this thread? ;)

-Andrew.
Jul 18 '05 #110

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

Similar topics

0
1400
by: Mark Hahn | last post by:
I would like to announce a new interpreted object-oriented language very closely based on Python, that is Prototype-based, like Self (http://research.sun.com/research/self/language.html) instead of class-based like Python. I have named the language Prothon, short for PROtotype pyTHON. You can check it out at http://prothon.org. The prototype scheme makes object oriented computing very simple and complicated things like meta-classes...
0
1314
by: Mark Hahn | last post by:
Ben Collins and I have developed a new interpreted object-oriented language very closely based on Python, that is Prototype-based, like Self (http://research.sun.com/research/self/language.html) instead of class-based like Python. I have named the language Prothon, short for PROtotype pyTHON. You can check it out at http://prothon.org. The prototype scheme makes object oriented computing very simple and complicated things like...
28
3305
by: David MacQuigg | last post by:
I'm concerned that with all the focus on obj$func binding, &closures, and other not-so-pretty details of Prothon, that we are missing what is really good - the simplification of classes. There are a number of aspects to this simplification, but for me the unification of methods and functions is the biggest benefit. All methods look like functions (which students already understand). Prototypes (classes) look like modules. This will...
7
3563
by: Michele Simionato | last post by:
So far, I have not installed Prothon, nor I have experience with Io, Self or other prototype-based languages. Still, from the discussion on the mailing list, I have got the strong impression that you do not actually need to fork Python in order to implement prototypes. It seems to me that Python metaclasses + descriptors are more than powerful enough to implementing prototypes in pure Python. I wrote a module that implements part of what...
49
2626
by: Mark Hahn | last post by:
As we are addressing the "warts" in Python to be fixed in Prothon, we have come upon the mutable default parameter problem. For those unfamiliar with the problem, it can be seen in this Prothon code sample where newbies expect the two function calls below to both print : def f( list= ): print list.append!(1) f() # prints
20
1813
by: Mark Hahn | last post by:
Prothon is pleased to announce another major release of the language, version 0.1.2, build 710 at http://prothon.org. This release adds many new features and demonstrates the level of maturity that Prothon has reached. The next release after this one in approximately a month will be the first release to incorporate the final set of frozen Prothon 1.0 language features and will be the Alpha release. You can see the set of features still...
0
9416
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9979
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9849
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8861
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3948
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
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.