What's better about Ruby than Python?

  • Thread starter Brandon J. Van Every
  • Start date
B

Brandon J. Van Every

Asun said:
Doesn't that just mean a lot of people will be able to talk about you
behind your back without your ever realising?

That's the point! I *want* them to! I look so, so much better when people
abuse me and I don't answer them at all. People figure out pretty quick
who's really full of it or not. The killfile makes the process...
automatic. It's just messy now because the killfile is still being built.
Congratulations, you've just managed to deprive yourself of the often
insightful contributions of a regular poster to this newsgroup.

Lulu??!? You think with the kind of barb he made, that my e-mail address is
synonymous with "troll," that I care about his insights? or think that he
has any to offer? Even if he does, I'll decline that trouble. It ain't
worth it.
I wonder if you wouldn't be better off simply not participating in
Usenet groups at all. You'll save significant amounts of diskspace
without that killfile of yours,

Please. We all know how tiny text storage is, EVEN WHEN IMPLEMENTED IN
PYTHON. ;-)
not to mention keystrokes.

True. The problem is, I'm still young and stupid enough to believe that I
can have a cumulative effect on Usenet behavior. Maybe in 10 years I'll see
the light.
But please
feel free to add me to your much vaunted killfile as well, that way
you don't have to listen one of the few people who, in this thread,
actually took your question seriously and gave a substantive answer.

It's not that easy. You have to actually insult me, show an incapacity to
rate me as anything but "troll," and/or demonstrate your complete
unwillingness to be useful. The exact combo is a judgement call, but easily
seen when there. For example, Doug Tolton fulfilled the criteria, albeit
barely. Albeit again, quite deliberately, so not so barely. You yourself
have failed, you will have to try harder if you want into my killfile.
MHHUUAHAHAHHAHAHHAHAAAA!!!!

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
C

Cliff Wells

The problem here is, they aren't troll posts. You just perceive them to be.
Why you do, you'd have to answer for yourself. But I will hazard to guess:
you don't like it when certain questions are asked. You think they are
illegitimate questions, and that nobody, rationally speaking, should ask
them. You think the questions will always cause trouble, that we can count
on this from what we know about newsgroup behaviors, so therefore the
questions should not be asked. In other words, you think you know best
about how discourse should properly proceed.

There is a grain of truth to this. Certain questions and conversations
almost inevitably lead to flame wars. This is well-known to long-term
usenet users. This is why people who ask such questions are usually
referred to the archives where such battles have been waged ad nauseum.
There is a definite tendency to try to deflect such battles before they
begin. To try to force those battles is about as reliable an indicator
of trolling as is "URGENT: YOUR IMMEDIATE ASSISTANCE REQUIRED" is a
reliable indicator of Nigerian spam. It should come as no surprise to
you that people mistake your posts as trolling. They may be incorrect,
but it is certainly a reasonable assumption. As such, the burden is on
you to demonstrate otherwise. To do otherwise is simply taking
advantage of the fact that this ng isn't moderated (in which case you
would certainly have been moderated out of existence by this point).
You seem to be under the impression that people here are hostile to
certain points of view, but I'm aware of at least one time in the past
year or so when the topic of forcing someone from the ng came up and
most were vehemently opposed to such tactics, even though the person in
question had irked everyone to no end.
Like most groups of people with an intellectual leaning, people here
tend to be fairly skeptical. Making inflammatory assertions with no
supporting arguments is bound to gather you the flames you seem to be
asking for.
I am starting to wonder, if the high number of kills I've gotten in c.l.p
says something about community cohesion? I mean, I get kills in *every*
group I spend any time in, but the speed and volume of kills I'm getting
here is novel. It's usually much more isolated and sporadic than this. I
hereby pronounce c.l.p, Second Order Magnitude of community cohesion. You
guys aren't all in the same pocket or parrots of each other, but there are
clearly some trends.

This is actually quite insightful. I'd agree that as a whole this ng is
rather cohesive. Most people who come to this ng comment on its overall
friendliness and helpfulness. That is something rather rare on usenet.
Those of us who spend a good portion of our days here prefer it that
way. And it isn't a "we don't take kindly to strangers" small-town
mentality. Python is a pragmatic language and tends to attract
pragmatic people. Long-winded dissertations on things not-Python tend
to be tolerated to the extent the participants contribute to things
Pythonic. Were you known to be a contributor, either with code or
knowledge, your forays into time-wasting speculation would most likely
be much better received. As it is the only "contribution" you've made
is a generous use of other people's time and bandwidth.

The fact that you get "kills" in every ng you spend time in probably
says more about you than other people. Personally I've never killfiled
anyone (not even the ruebot[!]) and to my knowledge, I've yet to be
killfiled (although at times I'm a bit surprised at that, today being
one of those times). As you've acknowledged in another post (although
in somewhat different words), people tend to create the world they live
in. You've also claimed to be a pugilist. Why then, are you surprised
when people choose to fight with you? Taking your statements together
would seem to indicate that a fight is what you want. People who
actively seek fights in newsgroups are called trolls. You can take this
to its logical conclusion as others already have. To quote another post
of yours (see, I'm still reading): "Generally, it is broadening to put
yourself in someone else's shoes." If others are (mis)perceiving you as
a troll, then perhaps you should try to see it from their point of view
for a moment. At the very least you'll have a better insight as to how
their accusations should be addressed and might actually prevail in the
argument. *plonk* is the sound the white flag makes when it hits the
top of the post.


Regards,
Cliff
 
B

Brandon J. Van Every

Michael said:
Personally, I think it's worth taking a little extra effort to try to
compensate for the limitations of the medium. If you know that people
are more likely to misunderstand your intentions, why egg them on?

Often, I have a misanthropic idea that I can negatively educate people. If
people "get into it," and later it is pointed out how they got themselves
into it, they might learn not to "get into it."

I don't know if in 10 years' time, I'll find it pointless to educate anybody
other than my own (future) children. I already have a theory of static
archetypes. Think I posted that in one of these forums, in one of these
kinds of interchanges. Basically, people change, but people change so
slowly that you can't measure it in weeks or months. It takes years. So if
you're dealing with people on a timespan shorter than a year, regard them as
a static type. They are part of a system, an ecology of types. They are a
certain enzyme. The Troll Hunters are a certain enzyme, so you espouse
Buddhist wisdom to them and also killfile them. There is nothing else to do
with them right now. Their growth will come later.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
B

Brandon J. Van Every

Ben said:
Bingo! Guilty as charged. And I get more and more abrasive the more
people call me a troll. As do most people who aren't actually
trolling.

Quite the opposite -- "get[ting] more and more abrasive the more
people call [one] a troll" is *exactly* how a troll acts.

So? Squares are rectangles, but rectangles are not squares.
People who aren't actually trolling will make efforts to depart from
troll-like behaviour when accused of it, to avoid confirming the
accusation.

Only in your world view. It's not a IFF.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
B

Brandon J. Van Every

Dave said:
Quite frankly most people of your ilk have a tendency to winge and
complain about "missing features" or "bad design" but do nothing to
contribute to the language. I fail to see why this puts you in any
position to ask the "tough questions" as you put it. If you see
something you consider to be a weakness, suggest a solution, don't
winge about the fact that it exists.

Well, I can certainly put up or shut up about *that* !

http://pythonology.com/pipermail/marketing-python/
http://www.3dprogrammer.com/Python_Logo_Draft.JPG
http://www.3dprogrammer.com/French_Python.JPG

Warning, last 2 are 754K and 461K, and you'll probably need to scroll.

I get tired of people who lack imagination, who think they know everything
about why so-and-so asks such-and-such a question, or speaks in
this-and-that a way. Who never exercise their imaginations, who don't try
to see from someone else's perspective. What do you really do, yourself, to
address the problems? And seeing these photos above, are you going to
falsely conclude that I care about Python? I don't. Not yet, at any rate.
This is a trial period.
Who cares ? If you want to go stick up posters for Python go for it.

That's why I spend my time working with the marketing-python crowd and not
your ilk. As far as I'm concerned, you are the enemy of progress. Because
progress requires relevance. "What language will be relevant 10 years from
now?" That is my agenda.
You certainly appear like a troll, so how about a few suggested
solutions to these so called problems you raised ?

Your wish is my command, Grasshopper. Now, what should I ask of you in
return? I know: nothing. You will either see or you will not see.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
B

Brandon J. Van Every

Donn said:
"Troll" is really a function of the audience.
Agreed.

These guys will
exist, there is this way of viewing the world as a dramatic
contest between the armies of Python etc.: You will lose, they
will eat your lunch, you're already dead and you don't know it,
bla bla. But it takes an audience that finds this sort of thing
in the least compelling, usually young males it seems.

I'm after something much bigger than Python. I'm after Permanent Computing.
I want any game I make to be archived for hundreds of years to posterity.
Championing an open source language, or figuring out how to surf Microsoft
indefinitely, is only the opening gambit.

It would not shock me if most people could care less about this agenda.
Most programmers are not also artists. They accept their ephemerality,
their complete wastes of time. In fact, they usually think it's kewl.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
E

Erik Max Francis

Brandon J. Van Every said:
I'm after something much bigger than Python. I'm after Permanent
Computing.
I want any game I make to be archived for hundreds of years to
posterity.
Championing an open source language, or figuring out how to surf
Microsoft
indefinitely, is only the opening gambit.

The abandonware community is alive with emulators. "Permanent
computing" is fool's gold.
 
B

Brandon J. Van Every

Cliff said:
Quoting the Dalai Lama:
Conventional truth, conventional reality is a consensus reality,
something that people agree on. Events do not have a reality of their
own. All events depend on other events. Nothing (no person) has an
independent identity, there is no intrinsic reality. What is called
"reality" depends on the context of other factors.

While I don't necessarily consider the Dalai Lama an authority on all
(or even many) things, I think there is certainly a great amount of
truth to this observation. If the majority of people think you are
trolling, then, whether you intend to or not, perhaps you are.

Then you missed what the Dalai Lama said. He did not speak of essence. He
spoke of events depending on other events. And I'm quite conversant with
what Troll Hunters depend on.
If you were being truly pragmatic, as you claim, then you must surely
realize that offending people with an abrasive approach is
counter-productive.

Counter-productive to what agenda? My current agenda is identifying the
unworkable people and disposing of them.
You might think that killfiling those people will teach
them a lesson (it won't, they could probably care less),

Frankly, I don't think I've killfiled anyone who's worth the trouble to
un-killfile. I seriously doubt that they have anything important to say
that I have to hear.
Part of the reason people respond to you so violently is because you
tend to make unsubstantiated and provocative claims and then accuse
people of being "knee-jerk reactionaries" when they dismiss them.

It's only the people calling me a troll that I label "knee-jerk
reactionaries."

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
B

Brandon J. Van Every

Cliff said:
To try to force those battles is about as reliable an indicator
of trolling as is "URGENT: YOUR IMMEDIATE ASSISTANCE REQUIRED" is a
reliable indicator of Nigerian spam. It should come as no surprise to
you that people mistake your posts as trolling. They may be
incorrect, but it is certainly a reasonable assumption.

I hate to use an Eep-ism, but it's time for people to evolve. "You sound
like a troll" is not that reasonable an assumption. Outside of politics
newsgroups, I've almost never seen actual trolls. I've seen plenty of
people insulting each other, totally unable to see the other person's point
of view. I've seen countless instances of Troll Hunting all over Usenet
that had nothing to do with me. In fact, it's clearly a popular newsgroup
sport! People are intellectually lazy, they don't have an ironclad
criterion for what is or isn't a troll. A troll is anything they don't
like. They don't use imagination or exercise benefit of the doubt when
controversial posts appear. They just enjoy naming things within a familiar
pigeonholeing system. It comforts them. They are so focused on controlling
group discourse, and not letting "the wrong kind of conversation" happen,
that they don't put much thought into what was said in the first place.
Were you known to be a contributor, either with code or
knowledge, your forays into time-wasting speculation would most likely
be much better received. As it is the only "contribution" you've made
is a generous use of other people's time and bandwidth.

As I see it, my detractors are enginerds with no appreciation for or skill
at marketing. Nor, probably, much awareness of Python marketing efforts.
That's how I figure you can (1) blithely ignore my analysis of Reality On
The Ground, (2) merrily claim I'm a do-nothing. I've suggested you look at
the marketing-python archives several times, it's a comment I've peppered
here and there. Have you?
The fact that you get "kills" in every ng you spend time in probably
says more about you than other people.

Actually, it says more about where I am in life. There was a time when I
never killfiled anybody. If I was rude, and we got into fights, we'd just
keep fighting. Often we'd kiss and make up. But sometimes, I'd get an
intractable, unforgiving, obsessive compulsive fixated asshole on my ass for
years. It drove me out of comp.games.development.* for a time, the
hierarchy I created. I got fed up with being told that I was a troll,
seeing as how I'd been Newsgroup Proponent. What the hell is that, the
ultimate trolling? I've never trolled in my life. Abrasive, argumentative,
violent, sure. Trolling, never.

Anyways, a few years later I came back. I've been summarily killfiling
people ever since. It does wonders for my long-term interaction with people
and groups. I don't have to deal with the people I can't work with.
Personally I've never
killfiled anyone (not even the ruebot[!]) and to my knowledge, I've
yet to be
killfiled (although at times I'm a bit surprised at that, today being
one of those times).

It's really very simple. Your behavior is not the same as other people's
behavior. That's why we're still talking.
Why then, are you surprised when people choose to fight with you?

Why do you say I'm surprised? This is all very predictable to me. Seen at
this moment in time, you are a static type within this system. You just
happen to be a benevolent, workable type. You are the "Well, are you going
to killfile *me* too?" type. The kind of person who doesn't behave in a way
that I would killfile, and who doesn't quite understand how his behavior is
different from the people I do killfile. But, who probably will understand
by the time I get done explaining it.

Have you seen Enter The Matrix? The scene with The Architect is very
profound. The Matrix demands Neo. Someone else observed, this stuff is all
about young males. That's no accident, it's a feature of our genetics. Our
genetics demand certain confrontations at a certain age. In our lives, we
obey certain Grand Strategies, even if we are sapient and exercising choice
over the details.
Taking your statements together
would seem to indicate that a fight is what you want.

That's sorta true. This is really what I call a "posting binge," to avoid
other things I don't want to be doing. I'm an intellectually violent
person, I like a good debating scrap. But I've got Rules Of Engagement
about what I think is appropriate, intellectually defensible debate.
"You're a troll!" instead of hearing someone else's opinion ain't it. Those
people, I want to punish. It's irrational, because intellectually I know I
can't actually change them. Rationally, I can killfile them. Possibly, I
can stimulate cumulative change in the system, but I am uncertain of it. In
10 years maybe I will have let it go.

For instance, I'm reasonably sure I can stimulate minor change in your own
static type. You understand enough of the dimensions already that you're
capable of absorbing more of them. But you'll have probably gotten there on
your own soon anyways, so am I really needed as a stimulus?

Actually, I suspect I'm not for your benefit, if I am for anyone's benefit.
I suspect it is for someone who is lurking. Maybe someone who hasn't formed
much of a world view yet. Mine, at any rate, is in my .sig.

--
Cheers, www.3DProgrammer.com
Brandon Van Every Seattle, WA

20% of the world is real.
80% is gobbledygook we make up inside our own heads.
 
D

David M. Cook

Brandon J. Van said:
I ask tough questions about Python vs. other languages and platforms.

Why don't you work on some tough solutions?
Some
people can't handle it. Maybe they'd handle it if I diplomatically sugar
coated it, but I'm not going to. Things to irritate the "Brandon's a troll"
crowd some more:
- Python is not a good language for low-level 3D graphics problems. C++ is
better.

Not many programmers are going to write their own low-level 3D code. Python
has bindings to 3D libraries. For some specialized applications this will
not be adequate, but I don't think that is something worth worrying too much
about.
- Python isn't a rapid prototyping godsend for every problem out there.

Someone said that it was? BTW, in your experience, for which problems is
Python not good for rapid prototyping?
- GUI and tools support can end up being more important than language
niceties.

Luckily Python has both excellent GUI and tool support *and* language
niceties.
- Microsoft C# and .NET are strategic threats to Python's prosperity and
vitality, if not survival.

Sounds like a good opportunity for someone who sees such a threat to work
out and implement a response.
- Pythonistas should consider trying to eat Java's lunch, because they
aren't going to eat Microsoft's lunch.

Sounds like a good opportunity for someone interested in eating Java's
lunch to work out and implement a plan for doing so.
- Ruby has some mindshare among people with knowledge of Python.
OK.

- Yet unnamed languages are capable of taking Python's place on the food
chain.

I'll worry about it when they get names. I like learning new languages.
Maybe unnamed language will be more fun than Python.
- You have to promote your language, grow its market share, to prevent that
from happening.

Sounds like a good opportunity for someone interested in marketing.

Dave Cook
 
A

Alex Martelli

Heiko Wundram wrote:
...
class X:
def test(*args):
print args

X.test() # 1
x = X()
x.test() # 2
X.test(x) # 3

Run this, and for the first call you will get an empty tuple, while for
Wrong:
.... def test(*args): print args
....Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: unbound method test() must be called with X instance as first
argument (got nothing instead)
X.test is not a function -- it's an unbound method; to call it, you
MUST therefore pass it at least one argument, and the first argument
you pass to it must be an isntance of X (or of any subclass of X).
on the instance they are associated with. If you have a predeclared
self, only calls 2 and 3 would work, if the self parameter is just
another parameter for the function, I can miraculously call the function
just like it is (see call 1).

You seem to be wrongly assuming that "call 1" works, without having
tested it -- in fact, it fails in any version of Python. Therefore,
the "fact" that it works, being not a fact, cannot serve to support
"having no predeclared self" (nor any other thesis).

As for me, I have no special issue with "having to specify self" for
functions I intend to use as bound or unbound methods; otherwise I
would no doubt have to specify what functions are meant as methods
in other ways, such as e.g.

def [method] test(what, ever):
...

and since that is actually more verbose than the current:

def test(self, what, ever):
...

I see absolutely no good reason to have special ad hoc rules, make
"self" a reserved word, etc, etc. Python's choices are very simple
and work well together (for the common case of defining methods
that DO have a 'self' -- classmethod and staticmethod are currently
a bit unwieldy syntactically, but I do hope that some variation on
the often-proposed "def with modifiers" syntax, such as

def [classmethod] test(what, ever):
...

or

def test(what, ever) [classmethod]:
...

will make it past the BDFL filters in time for Python 2.4:).


Alex
 
A

Alex Martelli

Asun Friere wrote:
...
Ah yes, back to substance. I forgot to mention that Ruby ranges seem
much more intuitive than Python slicing. But I think the confusion,

Having both a..b AND a...b -- one indicating a half-open range, another
indicating a closed range -- "more intuitive"? You gotta be kidding...
to the extent that confusion does exist, is because Python has one
foot in the C-like 'n-1 indexed array' camp (in relation to ordinary
indexing of elements), and one in the '0 is not an ordinal, but a
point of origin,' camp (in relation to splitting). :ducks.

Python's firmly in the "always half-open" field (pioneered in print,
to the best of my knowledge, in A. Koenig's "C Traps and Pitfalls",
and -- no doubt partly thanks to Koenig's influence -- pervasive in
the C++ standard library too). Not sure where _splitting_ enters
the picture -- you mean, e.g., 'a few words'.split()? What's THAT
gotta do with intervals, or slices?


Alex
 
A

Alex Martelli

Alexander Schmolck wrote:
...
To recap: usually, if I change a class I'd like all pre-existing instances
to become updated (Let's say you develop your program with a running

If you CHANGE a class (mutate a class object), that does indeed happen.

You seem to have some deep level of confusion between "changing an
object" and "rebinding a name (that happened to be previously bound
to a certain object) so it's now bound to a different object".

Rebinding a name *NEVER* has any effect whatsoever on the object that
might have, by happenstance, previously bound to that name (except that,
when _all_ references to an object disappear, Python is free to make
that object disappear whenever that's convenient -- but that doesn't
apply here, since if a class object has instances it also has references
to it, one per instance).

This rule is universal in Python and makes it trivially simple to
understand what will happen in any given occasion -- just as long
as you take the minimal amount of trouble to understand the concepts
of names, objects, binding (and rebinding) and mutation. If a language
has no such clear universal rule, you're likely to meet with either
deep, complex trouble, or serious limitations with first-classness
of several kinds of objects. In Python everything is first-class,
and yet there is no substantial confusion at all.

Repeat with me: rebinding a name has just about NOTHING to do with
mutating an object. These are VERY different concepts. Until you
grasp them, you won't be a very effective programmer.
python session; you notice a mistake in a method-definition but don't want
to start over from scratch; you just want to update the class definition
and have this update percolate to all the currently existing instances.

I assume that by "update the class definition" you mean that you want
*necessarily* to use some:

class X: ...

statement that defines a NEW class object (which may happen to have
the same name as an existing class object -- quite irrelevant, of
course). OK, then, so arrange (easily done with some function or
editing macro, if you have a decent editor / IDE) to do the following:

oldX = X # save the existing classobject under a new temporary name

class X: ... # define a completely new and unrelated classobject

oldX.__dict__.clear()
oldX.__bases__ = X,

# in case you also want to change the old class's name, you might:
oldX.__name__ = X.__name__ # so you're not constrained in this sense

# optionally, you can now remove the temporary name
del oldX

There. What's so hard about this? How does this fail to meet your
desiderata? Wouldn't it have been easier to ask, in the first place,
"I would like to obtain this effect, is there a Python way" (being
a BIT more precise in describing "this effect", of course!-), rather
than whining about "Python can't do this" and complaining of this as
being "unreasonable"?

AFAIK doing this in a general and painfree fashion is pretty much
impossible in python (you have to first track down all instances -- not an

I personally wouldn't dream of doing this kind of programming in production
level code (and I'd have a serious talk with any colleague doing it -- or
changing __class__ in most cases, etc). But depending on one's development
style and usage it may perhaps be helpful. If I did that often, of course,
I would ensure that the simple function:

def updateClass(oldClass, newClass):
oldClass.__dict__.clear()
oldClass.__bases__ = newClass,
oldClass.__name__ = newClass.__name__

was automatically loaded at entry in the interactive environment (see e.g.
the PYTHONSTARTUP environment variable for doing this in the usual text-mode
interactive interpreter).
I think this sucks big time, because it greatly devalues the interactive
programming experience for certain tasks, IMHO, but maybe I'm just missing
something since typically nobody complains.

I don't think the fact that nobody complains is strongly connected to the
fact that most Python users grasp the possibility of updating a class by
modyfying its __dict__ etc; indeed, one great thing about Python is that
most users typically tend to SIMPLICITY rather than "cleverness" -- if they
wanted to modify a class X's method Y they'd code it as a function F and
then simply do X.Y=F -- extremely simple, rapid, effective, and no need
to much with redoing the whole 'class' statement (a concept I personally
find quite terrible). Rarely does one want to modify an existing class
object any more 'deeply' than by just redoing a method or two, which this
utterly simple assignment entirely solves -- therefore, no real problem.

If your style of interactive programming is so radically different from
that of most other Pythonistas, though, no problem -- as you see, if you
put some effort in understanding how things work (particularly the
difference between *MODIFYING AN OBJECT* and *REBINDING A NAME*), Python
supports you with power and simplicity in MOST (*NOT* all) metaprogramming
endeavours.

If you DO want total untrammeled interactive and dynamic metaprogramming
power, though, *THEN* that's an area in which Ruby might support you
even better -- for example, this Python approach would *NOT* work if
oldClass was for example str (the built-in string class -- you CANNOT
modify ITS behavior). Personally, for application programming, I much
prefer clear and well-defined boundaries about what can and what just
CANNOT change. But if you want EVERYTHING to be subject to change, then
perhaps Ruby is exactly what you want. Good luck with keeping track
of what names are just names (and can be freely re-bound to different
objects) and which ones aren't (and are more solidly attacked to the
underlying objects than one would expect...).


Alex
 
A

Alex Martelli

Doug Tolton wrote:
...
abstractions and better programmer productivity. Why not add Macro's
allowing those of us who know how to use them and like them to use
them. If you hate macros, or you think they are too slow, just don't
use them.

"No programmer is an island"! It's not sufficient that *I* do not use
macros -- I must also somehow ensure that none of my colleagues does,
none of my clients which I consult for, nobody who posts code asking
for my help to c.l.py or python-help -- how can I possibly ensure all
of this except by ensuring that macros ARE NOT IN PYTHON?! "Slow" has
nothing to do with it: I just don't want to find myself trying to debug
or provide help on a language which I cannot possibly know because it
depends on what macros somebody's defined somewhere out of sight. Not
to mention that I'd have to let somebody else write the second edition
of the Nutshell -- if Python had macros, I would have to cover them in
"Python in a Nutshell".

They don't change the underlying language, they just add a
more useful abstaction capability into the language.

They may not change the "underlying" language but they sure allow anybody
to change the language that is actually IN USE. That is definitely NOT
what I want in a language for writing production-level applications.

I dearly hope that, if and when somebody gives in to the urge of adding
macros to Python, they will have the decency to FORK it, and use an
easily distinguishable name for the forked Python-with-macros language,
say "Monty". This way I can keep editing future editions of "Python in
a Nutshell" and let somebody else write "Monty in a Nutshell" without
any qualms -- and I can keep programming applications in Python, helping
people with Python, consulting about Python, and let somebody else worry
about the "useful abstaction" fragmentation of "Monty". If that "useful
abstaction" enters the Python mainstream instead, I guess the forking
can only be the last-ditch refuge for those of us (often ones who've seen
powerful macros work in practice to fragment language communities and
end up with "every programmer a different language"... do NOT assume that
fear and loathing for powerful macro systems comes from LACK of experience
with them, see also the Laura Creighton posts whose URLs have already
been posted on this thread...) who'd much rather NOT have them. But maybe
moving over to Ruby might be less painful than such a fork (assuming THAT
language can forever stay free of powerful macro systems, of course).

I have nothing against macros *IN GENERAL*. I just don't want them *in
my general-purpose language of choice for the purpose of application
programming*: they add NOWHERE NEAR ENOUGH PRODUCTIVITY, in application
programming, to even START making up for the risks of "divergence" of
dialects between individuals, groups, and firms. If I was focused on
some other field than application programming, such as experimental
explorations, tinkering, framework-writing, etc, I might well feel quite
otherwise. But application programming is where the big, gaping hole
of demand in this world is -- it's the need Python is most perfectly
suited to fulfil -- and I think it's the strength it should keep focus
and iinvestments on.


Alex
 
A

Alex Martelli

John J. Lee wrote:
...
I'd never noticed that. Greg Ewing has pointed out a similar trivial
wart: brackets and backslashes to get multiple-line statements are
superfluous in Python -- you could just as well have had:

for thing in things:
some_incredibly_long_name_so_that_i_can_reach_the_end_of_this =
line

where the indentation of 'line' indicates line continuation.

I see somebody else already indicated why this isn't so.

The differences between Ruby and Python are, in the end, about as far
from significant as it's possible to be (near as I can tell from

Yes, they're extremely similar languages.
You may be right there. Guido's comment that tuples are mostly
mini-objects did clarify this for me, though.

Oh, I'm quite "clear" on the issue, I just think it's a design
error to have tuples in Python, that's all (rather than just an
immutable version of lists for hashing purposes, for example).

In the end, though, don't you agree that any such judgement is, from
the pragmatic point of view, pointless once you realise how similar
the two languages are?

No, I entirely disagree. I do have to choose one language or the
other for each given project; I do have to choose which language
to recommend to somebody wanting to learn a new one; etc, etc.
If somebody sneakily switched Python and Ruby
in the middle of the night (so that suddenly many more people use
Ruby, and much more code was written in Ruby than in Python), you'd
stick with Ruby, wouldn't you?

Non-linguistic considerations such as the above may also have their
weight, in some case. But they're not huge ones, either.
*in*distinguishable. Ha! I found a bug.

You're wrong, see e.g. http://dict.die.net/undistinguishable/ :
the spellings with the initial "u" and "i" are just synonyms.

If I had to use Ruby for such a large application, I would
try to rely on coding-style restrictions, lots of tests (to
be rerun whenever ANYTHING changes -- even what should be
totally unrelated...), and the like, to prohibit use of this
language feature. But NOT having the feature in the first
place is even better, in my opinion -- just as Python itself
[...]

I mostly agree, but I think you could be accused of spreading FUD
about this. Does anybody *really* choose to alter string-comparison
semantics under everybody else's nose in Ruby?? That would be like

As I see others indicated in responses to you, this is highlighted
and recommended in introductory texts. So why shouldn't many users
apply such "big guns"?
doing

import some_module

def evil_replacement_function(): return blah()

some_module.important_function = evil_replacement_function


in Python, wouldn't it?

And hopefully this WILL be deprecated in 2.4 (pity that there just
was not enough time and consensus to do it in 2.3, but the BDFL
really liked the concept). Still, the Python usage you mention
is LESS problematic, in that the influence on some_module is
very explicit -- while altering Object (or whatever) in Ruby is
a way to IMPLICITLY AND HIDDENLY influence EVERY other module.
It's a *covert* channel -- a disaster, in large applications.

Thus, the direct Python equivalent might be

import __builtins__
__builtins__.len = someotherfunction

and THAT usage is very specifically warned against e.g. in
"Python in a Nutshell" -- you CAN do it but SHOULDN'T (again, one
can hope to eventually see it "officially" deprecated...!).


Alex
 
J

John J. Lee

Brandon J. Van Every said:
I almost got it.

Not meant to be 'got'. Your mention of 'runon' sentences just
reminded me of it, and that was good enough excuse for me :)


John
 
R

Roy Smith

Alex Martelli said:
They may not change the "underlying" language but they sure allow anybody
to change the language that is actually IN USE. That is definitely NOT
what I want in a language for writing production-level applications.

Here's a real-life example of how macros change the language. Some C++
code that I'm working with now, has a debug macro that is used like this:

DEBUG (cout << "I'm a debug statement\n";)

Note the semicolon inside the closing paren.

I write in emacs, and depend heavily on its knowlege of C++ syntax to
auto-indent. It's not just a convenience, it's an interactive typo
prevention tool (if the code doesn't indent the way I expect, it's
probably because I messed up the punctuation). I'm personally not a big
fan of syntax coloring, but many people are, for much the same reason.

The problem is, emacs doesn't know what to do with the code above. It
doesn't see a trailing semicolon, so (IIRC), it tries to indent the next
line another step, as if it were a continuation of the same statement.
What a pain. Eventually, I figured out I could "solve" the problem by
adding an extra semicolon at the end:

DEBUG (cout << "I'm a debug statement\n";);

It looks ugly, but at least it indents correctly.

Before you start ranting about emacs, note that there are lots of
language-aware editors (and other tools), all of which would suffer from
the same problem. The macro has essentially invented new syntax, which
the tool can't possibly know about.
 
A

A.M. Kuchling

Roy Smith wrote:
My view of this is that if you really want to do this, you're better off
inventing a separate language -- however similar to Python -- and using
a processor to turn that language into real Python, which can then be
interpreted. In an interpreted language, especially one as dynamic as

The problem is that writing such a processor is pretty messy. I've just
been writing a translator for a supersmall subset of Python ('while', 'for',
assignment, and that's it). While it was possible to do it with the
Lib/compiler/ package, the code for parsing the subset and generating Python
code from it is 12 screens long, ~300 lines of code. It's also difficult to
change the keyword set; for now I'm simply disallowing variables named 'in',
for example.

Macros would generally be a compact way of doing this, though that
compactness would have a cost (just like regular expressions are concise
but not very readable). Perhaps the solution isn't macros, but some kind of
Python-like-language parsing toolkit that's more easily customizable
than the compiler package is.

--amk
 
J

John Roth

Heiko Wundram said:
I think you're not getting the main point in a difference between Ruby
and Python here, and why it makes (IMHO) no sense to have a default self
in a function:

class X:
def test(*args):
print args

X.test() # 1
x = X()
x.test() # 2
X.test(x) # 3

Run this, and for the first call you will get an empty tuple, while for
the second call, you will get a tuple with the first parameter set to a
class instance of X, and for the third call the same as for the second
call. Remember about method binding (method/function difference), and
the like.

I want to have class-functions which can be callable either as a
function of the class (doing something on input-data), or work directly
on the instance they are associated with. If you have a predeclared
self, only calls 2 and 3 would work, if the self parameter is just
another parameter for the function, I can miraculously call the function
just like it is (see call 1).

I find it reasonable enough to have a feature like this to not complain
about having to specify self as the first parameter, always.

If every function/method has access to an instance/class whatever,
then there is clearly no reason to waste keystrokes specifying it on
the function/method header. I would think this would be obvious.

John Roth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,102
Messages
2,570,646
Members
47,247
Latest member
GabrieleL2

Latest Threads

Top