[IronPython] more pythonic than python ( continuation)

Brandon Furtwangler furtwan1 at msu.edu
Wed Jun 21 01:59:37 CEST 2006


The biggest problem that I see in your line of thought is that many of the
worst languages have gone down this route only to become a complete mess of
random compiler-does-what-you-meant rules.  In the end it just adds
complexity and only helps out a few newbie's.  After you use python (or most
other modern languages) you know the very simple rule that strings are
immutable.  If they were immutable, but the compiler helps you out and does
some clever trickery behind your back, this would only cause more confusion
when you don't expect it (in error) than the error you got.

I dread using old school PHP because some of the libraries do something
similar.  Some functions (but not all) that require an array as an input
parameter but will allow non-array inputs and will automagically wrap them
in an array.  While that might sound like a good convenience for the user it
has bit me in the ass many times because I pass the wrong variable and never
get an error message.  This is a general problem with dynamic languages, but
it's similar to the idea of having the compiler help newbie's.



-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of fernando moreira
Sent: Tuesday, June 20, 2006 2:43 PM
To: users at lists.ironpython.com
Subject: [IronPython] more pythonic than python ( continuation)



Thanks for your kind replies.

As newbie, i forgot to use 'self' inside the constructor :P . Of course, i
can't argue beside your expertises about the internal mechanics of the
language.

But since i am newbie and sice python intends to be easy to learn, compact,
clean, friendly, intuitive, execelent first language etc... I can express
the following:


I type

>>>str = "abc"; str[0] = "z"

Then the interpreter thinks "Oh no! Here comes another newbie that does not
know that strings are imutable or else all sorts of nasty consequences would

happens. Can't he read the manual more carefully ? Why can4t he type      
str = 'z' + str [1:]       or   maybe write some class to deal with it ? Let

me send him my traditional error message."

But what i would expect from a really pythonic interpreter is "He he he... 
Another newbie that does not know strings are imutable. I am a very friendly
interpreter of a very intuitive language; ).  So, behind the scenes i will
send the present string to trash after i create another one with the same
variable4s name. Thus the newbies will keep smiling and saying that python
rocks !"


Ok. I can begin to learn to use __slots__ and/or "several tricks with
``__setattr__``, metaclasses, and ``__slots__`` that can all be used to
achieve what i want". But i don4t FEEL it is the lovely PYTHONIC way.

Let me abuse of your time and tell a little history. Around 25 years ago,  i
passed happy hours using trs-80 basic ( if my memory is not failing). That
hobby had no continuation . About 15 months  i decided to program again. I
searched the internet for which language i should use. C# was not an option
because i thouhgt i had to buy it. I started with C++. Being self-taught  in

C++ and coming from a background of the old procedural, clean-sintaxed 
C++ and
compact Basic was like a stand in a torture chamber. Then i tryed Java, wich
promissed to throw in the garbage can the complication of C++ and was a
plataform too. I mean it had(s) functions(classes) to deal with mouse and
image on screen, etc... Still i coud not believe that as computers and
applications turned so  amazing powerfull along decades, the computer
languages had dismissed the good old Basic and adopted some really
complicated sutff. After experimenting other languages  in internet, i met
Python. Wooow, love at first sight ;). Python seemed to be what i dreamed a
computer language should be. I shout to my
son: "Come here quickly cause your daddy will teach you computer
programmimg.!". But my honeymoon with Python had some problems. I wanted to
program 2D games and there was no good GUI to do  it.

Then Ironpython shined in my life. Till then i had no idea of what .NET
meant. I thought it was only a marketing performance of MS, weak in content.

Well, i had difficoulties self-taughting me Python and .NET trhough the
IronPython iterpreter and the complex ( for beginners)  C# examples MSDN
show. I had to translate them to IronPython -  i got no idea i already  had
a C# compiler in my computer :P.  Ahh.. and i was self-teaching GUI
programming and OOP at the same time ( though i have to admit that my
experiments with Java and C++ helpded a bit).

For not be longer, i can tell that i felt in love with MSIL ( only wish it
was more compact ), had sad deceptions with Python and ( you can laugh at
will, i am newbie and probably don4t have a clue about what i am talking ),
though i hate to use semi-colons all the time, the ugly brackets and the
verbosity, i feel myself much more confortabe, pleased and safe writing in
C# than in Python. I feel C# is more pythonic than Python after i had some
introduction to the language.

In Python my first program can be :
print "this is my first program"

Nothig can be simpler.
But when i have to deal with classes. in C# i can use the intuitive, easy,
friendly, etc... code like this...

public class Verbs {

	string bother;
	string annoy;

	public Verbs() {
		this.annoy = "argh";
            this.bother = "bargh"; } }

and everything works fine.

Well gentlemen, i am not here for complain about your job nor about
IronPython. Indeed i am very glad of what you have done. I am  bit sad
because now i know that make Python perfect ( as i dreamed it should be) is
not one of  your goals. I understand that it is not your responsability.

Thank you for your kind attention.

_________________________________________________________________
MSN Messenger: instale gratis e converse com seus amigos. 
http://messenger.msn.com.br





More information about the Ironpython-users mailing list