Python 3K or Python 2.9?

B

Bruno Desthuilliers

Erik Jones a écrit :
Yes, that is really the crux of the issue, though. While the former
may be syntactic sugar for the latter, once any syntactic sugar has
become prevalent enough, it becomes the expected norm

Being "the expected norm" is not enough to qualify has "being the right
thing to do".
and the latter
becomes clutter or, at best, awkward.

Until you want to dynamically add some generic function taking an object
as first arg as a method of a class or instance. Exposing most of the
inner working of it's object model is one of the greatest strength of
Python. And that's one of the reasons I (and probably other people here)
like this language.
It's something that really just
takes a little use until you get to the point where you don't usually
think of it but, every so often, the thought creeps in. I'm not
complaining, just pointing out if you step out of this particular box,
you'll realize that it really is a pointless one. Saying, "because
that's how Python does it" may be the only valid reason, but that
argument is about on par with a six year old's "just because...".

If you really think the only rationale for this is "just because", then
you're missing something IMHO.
 
T

TheFlyingDutchman

<Ironic>

Hi, I'm new to Python, I don't even fully know the language, never done
a full project in Python. What's more, probably I'll never will.
But that's not the point, the point is I want YOU people to modify the
language you know in and out, the program with which you've done many
systems, I want you to change it to suit my whims, so that I'll be
comfortable with the 3 ten liners I'll write.
TIA

</Ironic>

<Zobionic>
Hi, I've used Python and have fallen in love with it. I know exactly
how Guido pronounces his name and since I saw him use the obtuse
phrase syntactic sugar I try and work it into every discussion I have
on Python syntax. I hate it when anyone offers criticism of Guido's
language. I have a picture of Bruce Eckel with a red universal not
sign over it on my wall and I throw my mechanical pencils at it every
night. I am especially upset when someone talks bad about kluges like
@staticmethod or FunctionName = staticmethod(FunctionName). Sure "def
static" or "static def" would be so much cleaner, simpler and clearer
but let's face it my fellow Pythonistas, this language may have
started out based on what was easy for people to learn and use but
we're in Nerdville now and clean and clear have become roadblocks! I
have so much more respect for Perl and the way it developed now!
</Zombionic>
 
T

TheFlyingDutchman

The other half of the confusion is cleared up by considering that
Python methods are ordinary functions that don't magically "know" in
which "class" context they are executing: they must be told via the
first parameter.

They can be told all they want by the compiler/runtime - implicitly -
under-the-covers, out-of-sight.
 
B

Bruno Desthuilliers

TheFlyingDutchman a écrit :
<Zobionic>
Hi, I've used Python and have fallen in love with it. I know exactly
how Guido pronounces his name and since I saw him use the obtuse
phrase syntactic sugar I try and work it into every discussion I have
on Python syntax. I hate it when anyone offers criticism of Guido's
language. I have a picture of Bruce Eckel with a red universal not
sign over it on my wall and I throw my mechanical pencils at it every
night. I am especially upset when someone talks bad about kluges like
@staticmethod or FunctionName = staticmethod(FunctionName). Sure "def
static" or "static def" would be so much cleaner, simpler and clearer
but let's face it my fellow Pythonistas, this language may have
started out based on what was easy for people to learn and use but
we're in Nerdville now and clean and clear have become roadblocks! I
have so much more respect for Perl and the way it developed now!
</Zombionic>

<AolStrikesBack>
Hi, I'm totally unable to understand the difference between higher order
functions and language statements, nor why the first approach is way
better than the second. I'm totally clueless about Python's object model
despite many posts explaining it and pointing to relevant documentation.
And, ho, yes, I don't even understand the expression "syntactic sugar",
but I guess it must some dummy concept invented by the guy that wrote
Python whatever his name might be.

So I insist on posting that all this is a kludge and that Python should
be how I think it could be instead of trying to understand why it is the
way it is and why people actually using it like the way it is.

But what, given that I'm an AOL user still thinking it's kewl to hide
behind a pseudo, what else would you expect ?
</AolStrikesBack>
 
T

TheFlyingDutchman

<VivaLaFrance>
If you wanna know why the Renault Dauphine requires the driver to pull
down on the rearview mirror in order to shift into reverse you simply
need to open the hood and remove the engine and disassemble the
transmission and you will see that it has no way of distinguishing a
shift into third from a shift into reverse without a rearview mirror
pull. But these days most people just open the glove compartment when
shifting into reverse which works just as well!
</VivaLaFrance>
 
B

Bruno Desthuilliers

TheFlyingDutchman a écrit :
<VivaLaFrance>
If you wanna know why the Renault Dauphine requires the driver to pull
down on the rearview mirror in order to shift into reverse you simply
need to open the hood and remove the engine and disassemble the
transmission and you will see that it has no way of distinguishing a
shift into third from a shift into reverse without a rearview mirror
pull. But these days most people just open the glove compartment when
shifting into reverse which works just as well!
</VivaLaFrance>

Very interesting engineering problem. But a bit out of date and totally
unrelated to Python. Anything else ?
 
B

Bruno Desthuilliers

TheFlyingDutchman a écrit :
I made a complaint about a small design choice.

It's by no mean a "small" design choice.
I also made it in the
past tense at least once ("should have done it") and explicitly
expressed that I knew it wasn't going to happen. Python was created
based on a language that was designed to make it easy to use by
beginners.

Most beginners still find Python easy to use AFAICT. At least, I know a
lot of *non* programmers using it.
Doing so made it a clean and clear language. My preference
is for everything to be as clean and clear as possible.

Mine too, and that's why I like Python the way it is : syntactic sugar
for the common cases, *and* and easy way to play with lower levels when
necessary.

(snip)
Jury-rigging new features is going to make the elite happy but very
likely will be viewed differently by us average programmers.

"us" ? Who is "us" ?
Those are elite-type features that make code harder to understand by
average programmers and probably the elite as well.

Good news, there's a language designed exactly for "average programmers"
that find these kind of features - as well as anything as complex as
operator overloading, metaclasses, descriptors, higher order functions,
multiple inheritance, lazy evaluation, and anything dynamic - way too
"elite". It's named Java. The only drawback is that instead of "elite
features", you'll have to resort to mumbo-jumbo overcomplexified "design
patterns" and write ten times more code to solve the simplest things.

To make a long story short: if you don't understand some "advanced"
Python's features, then just don't use them. But have mercy and let us
"elite programmers" (lol...) use more of Python's power.
 
S

Steve Holden

TheFlyingDutchman said:
They can be told all they want by the compiler/runtime - implicitly -
under-the-covers, out-of-sight.
I wish you would keep these deep insightful comments to yourself. Your
knowledge of the interpreter internals appears to be based on
examination by crystal ball.

You conveniently ignore the fact that the situation described by David
Trudgett (and, by the way, your quoting with no attributions is also
becoming tiresome very quickly) is a *design choice*, not a mistake.
It's done precisely to make an explicit reference to the instance
available to methods.

You also conveniently ignore the fact that changing tis would also
change other aspects of the language, such as the ability to graft
functions into instances and classes as methods.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline
 
R

Robin Becker

Graham said:
.......
In that blog, Guido says:

"""Concurrency: It seems we're now happily out exploring here. I'm
looking forward to benchmarks showing that PP or similar (or
dissimilar!) solutions actually provide a performance gain. Another
route I'd like to see explored is integrating one such solution into
an existing web framework (or perhaps as WSGI middleware) so that web
applications have an easy way out without redesigning their
architecture."""
........

Well I have been trying out a system very like PP. For various reasons I prefer
to write my own scheduler based on more traditional code, but it's very easy to
get SSH based workers going. Agreed it's a noddy system, but I find the
following timings for the pp callback demo with start=1, end=200000000.

All the workers are similar to a pp local worker, but some are controlled via
ssh and hence have to be initialised by an argument like -c"exec input()" which
downloads some bootstrap code; I find that an easy way to utilize a server which
already has ssh.

The local workers are clearly dominant, but even though app1,app3,app4 are not
in the same country they can still be used to provide useful work.

I suspect most people won't want to use either ssh or socket based workers when
64 cpu machines arrive. The worker farm topology is also a bit wrong for
massively parallel stuff.

################################################################
Starting scheduler with 1 workers(1 local)
Partial sum is 0.69314718306 | diff = -2.50006693125e-009
Job execution statistics:
job count | % of all jobs | job time sum | time per job | worker
128 | 100.00 | 59.7190 | 0.466555 | local:3676
128 | 100.00 | 59.7190 | 0.466555 | all local
128 | 100.00 | 59.7190 | 0.466555 | total
Time elapsed since scheduler creation 59.7820000648
Real average time 0.467046875507


Starting scheduler with 2 workers(2 local)
Partial sum is 0.69314718306 | diff = -2.50006693125e-009
Job execution statistics:
job count | % of all jobs | job time sum | time per job | worker
64 | 50.00 | 31.5300 | 0.492656 | local:324
64 | 50.00 | 31.2190 | 0.487797 | local:3684
128 | 100.00 | 62.7490 | 0.490227 | all local
128 | 100.00 | 62.7490 | 0.490227 | total
Time elapsed since scheduler creation 31.5460000038
Real average time 0.24645312503


Starting scheduler with 3 workers(2 local)
Partial sum is 0.69314718306 | diff = -2.50006704228e-009
Job execution statistics:
job count | % of all jobs | job time sum | time per job | worker
53 | 41.41 | 25.6580 | 0.484113 | local:2392
52 | 40.63 | 25.5150 | 0.490673 | local:416
23 | 17.97 | 24.2500 | 1.054348 | ssh:RLUK_robin:20457
105 | 82.03 | 51.1730 | 0.487362 | all local
128 | 100.00 | 75.4230 | 0.589242 | total
Time elapsed since scheduler creation 25.7349998951
Real average time 0.20105468668


Starting scheduler with 4 workers(2 local)
Partial sum is 0.69314718306 | diff = -2.50006704228e-009
Job execution statistics:
job count | % of all jobs | job time sum | time per job | worker
46 | 35.94 | 22.2200 | 0.483043 | local:2328
46 | 35.94 | 22.4670 | 0.488413 | local:3580
21 | 16.41 | 22.3150 | 1.062619 | ssh:RLUK_robin:20500
15 | 11.72 | 21.9730 | 1.464867 | ssh:app1:3549
92 | 71.88 | 44.6870 | 0.485728 | all local
128 | 100.00 | 88.9750 | 0.695117 | total
Time elapsed since scheduler creation 23.0320000648
Real average time 0.179937500507

Starting scheduler with 5 workers(2 local)
Partial sum is 0.69314718306 | diff = -2.50006704228e-009
Job execution statistics:
job count | % of all jobs | job time sum | time per job | worker
40 | 31.25 | 19.3600 | 0.484000 | local:1376
41 | 32.03 | 19.7030 | 0.480561 | local:3608
18 | 14.06 | 19.1090 | 1.061611 | ssh:RLUK_robin:20524
14 | 10.94 | 19.1110 | 1.365071 | ssh:app1:3596
15 | 11.72 | 19.0950 | 1.273000 | ssh:app3:44316
81 | 63.28 | 39.0630 | 0.482259 | all local
128 | 100.00 | 96.3780 | 0.752953 | total
Time elapsed since server creation 19.9850001335
Real average time 0.156132813543

Starting scheduler with 7 workers(2 local)
Partial sum is 0.69314718306 | diff = -2.50006693125e-009
Job execution statistics:
job count | % of all jobs | job time sum | time per job | worker
31 | 24.22 | 14.9540 | 0.482387 | local:2588
31 | 24.22 | 15.0630 | 0.485903 | local:472
13 | 10.16 | 14.0790 | 1.083000 | ssh:RLUK_robin:20548
9 | 7.03 | 14.7680 | 1.640889 | ssh:app1:3626
11 | 8.59 | 14.3260 | 1.302364 | ssh:app3:44344
15 | 11.72 | 14.2990 | 0.953267 | ssh:app4:61396
18 | 14.06 | 14.4050 | 0.800278 | ssh:app5:1258
62 | 48.44 | 30.0170 | 0.484145 | all local
128 | 100.00 | 101.8940 | 0.796047 | total
Time elapsed since scheduler creation 15.2030000687
Real average time 0.118773438036
################################################################
 
T

TheFlyingDutchman

I wish you would keep these deep insightful comments to yourself. Your
knowledge of the interpreter internals appears to be based on
examination by crystal ball.

I am not talking about the way it does it, but rather, the way it
could do it or... could have done it. That requires no knowledge of
how the interpreter currently does it unless I am proposing something
that no interpreter in the world could ever do.
You conveniently ignore the fact that the situation described by David
Trudgett (and, by the way, your quoting with no attributions is also
becoming tiresome very quickly) is a *design choice*, not a mistake.
It's done precisely to make an explicit reference to the instance
available to methods.


For your own information, supercilious references to the interpreter
internals become tiresome quickly.

I made a complaint about a small design choice. I also made it in the
past tense at least once ("should have done it") and explicitly
expressed that I knew it wasn't going to happen. Python was created
based on a language that was designed to make it easy to use by
beginners. Doing so made it a clean and clear language. My preference
is for everything to be as clean and clear as possible. If I didn't
I'd never have bothered with Python since Perl is much more popular
among programmers I have come across.

Jury-rigging new features is going to make the elite happy but very
likely will be viewed differently by us average programmers.
change other aspects of the language, such as the ability to graft
functions into instances and classes as methods.

Those are elite-type features that make code harder to understand by
average programmers and probably the elite as well. To paraphrase
someone "He thought he'd solve the problem by grafting functions into
classes and grafting classes into methods. Then he had two problems".
 
A

Aahz

Aahz a écrit :

Sorry : a pseudonym (a nickname).

You apparently missed the thrust of my sarcasm. You can't tell what is
or is not a pseudonym online. For all I know, "Bruno Desthulliers" is a
pseudonym. While I recognize that there is some social advantage to
linking consistent identifiers with people, I have I think understandable
irritation with people who insist that names follow certain patterns.

(For those joining only recently, my full legal name is "Aahz", which I
changed from my former name precisely because of attitudes like Bruno's.)
 
S

Steve Holden

Aahz said:
You apparently missed the thrust of my sarcasm. You can't tell what is
or is not a pseudonym online. For all I know, "Bruno Desthulliers" is a
pseudonym. While I recognize that there is some social advantage to
linking consistent identifiers with people, I have I think understandable
irritation with people who insist that names follow certain patterns.

(For those joining only recently, my full legal name is "Aahz", which I
changed from my former name precisely because of attitudes like Bruno's.)
.... coupled with a certain bloody-mindedness that forces you to rub
people's noses in your ability to choose to do so? ;-)

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline
 
S

Steve Holden

Aahz said:
You apparently missed the thrust of my sarcasm. You can't tell what is
or is not a pseudonym online. For all I know, "Bruno Desthulliers" is a
pseudonym. While I recognize that there is some social advantage to
linking consistent identifiers with people, I have I think understandable
irritation with people who insist that names follow certain patterns.

(For those joining only recently, my full legal name is "Aahz", which I
changed from my former name precisely because of attitudes like Bruno's.)
.... coupled with a certain bloody-mindedness that forces you to rub
people's noses in your ability to choose to do so? ;-)

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline
 
A

Aahz

... coupled with a certain bloody-mindedness that forces you to rub
people's noses in your ability to choose to do so? ;-)

While there's certainly some truth to that, it is also the case that I
have seen people like Bruno take exception to some people's born names.
After all, there are people whose parents chose to name them "Moon Unit".

For that matter, there are plenty of people who are better known by some
nickname that is not their legal name. And even before I changed my
name, I had plenty of problems from people believing that my name was a
nickname and "helpfully" fixing it. (Which is really where my attitude
comes from, and the practical difficulties of having only one legal name
are not that much larger than my former difficulties.) Overall, I think
that Bruno's attitude is more injurious to community than letting people
be known by whatever name they choose.
 
B

Bruno Desthuilliers

Aahz a écrit :
For the record, I usually don't give a damn about what
name/nickname/whatever peoples use.
While there's certainly some truth to that, it is also the case that I
have seen people like Bruno take exception to some people's born names.
After all, there are people whose parents chose to name them "Moon Unit".

But then adding the lastname (ie 'Zappa') could clear the possible
confusion !-)
 
B

Ben Finney

Bruno Desthuilliers said:
For the record, I usually don't give a damn about what
name/nickname/whatever peoples use.

With the caveat "... so long as they consistently use one name in a
given context", I concur.
 
A

Alex Martelli

Aahz said:
For that matter, there are plenty of people who are better known by some
nickname that is not their legal name.

Yep. For example, some people whose legal name is "Alessandro" (which
no American is ever going to be able to spell right -- ONE L, TWO S's,
NOT an X or a J instead, "DRO" ending rather than "DER", etc), might
choose to avoid the hassle and go by "Alex" (just to make up a case...).


Alex
 

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
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top