New to Python: Features

  • Thread starter Richard Blackwood
  • Start date
A

Alex Martelli

Dan Bishop said:
Most of your questions are answered at http://docs.python.org/

Yep, but some of the answers are debatable. E.g.:

....but no rebinding in outer-scope, which to some people (not functional
programmers, obviously;-) means it ain't "proper".

Yes. This is done by defining the special methods __add__, __mul__,

....which doesn't let you define NEW operators, just the code that runs
when known operators are applied to objects of a certain user-coded
type. To define new operators, look instead for example to Haskell.
(I've never seen "operator overloading" used to describe "define new
operators", they're really totally distinct language features).


Alex
 
G

Glenn Andreas

Grant Edwards said:
Oh. My. Gaawwwd!

Which one, the "Rude much?" crack or the "You've got to be
kidding..." crack? The latter isn't all that improper
(especially not for Usenet). The former is colloqial US
English. More specifically it's "Valley Speak" -- made popular
outside "The Valley" by movies like "Valley Girl", "Mall Rats",
"Heathers", and just about any John Hughes movie (especially
Sixteen Candles). The first two are crap, but "Heathers" is a
good movie, and I still like "Sixteen Candles".

"Mall Rats" is set in New Jersey (part of the "Jersey Trilogy"), though
filmed in Minnesota, and is pretty much completely free of "Valley
Speak", but filled with "Jersey speak" (or whatever it would be called).

Heathers, however, is definitely a great movie... (and quite possibly
does include the line "Rude much?").
 
R

Richard Blackwood

I ran out of steam!

I started this without seeing that you posed 45 questions.

At the end, I'm inclined to support the Grant Edwards response.

Good luck,

Colin W.

The original idea was that people whom were experts in X would respond
to question only pertaining to X but I see that that was a foolish idea
of mine. Anyhow, thanks Colin and it sounds like Python has most of
what I want (though not all).
 
A

Aahz

Which one, the "Rude much?" crack or the "You've got to be kidding..."
crack? The latter isn't all that improper (especially not for Usenet).
The former is colloqial US English. More specifically it's "Valley
Speak" -- made popular outside "The Valley" by movies like "Valley
Girl", "Mall Rats", "Heathers", and just about any John Hughes movie
(especially Sixteen Candles). The first two are crap, but "Heathers"
is a good movie, and I still like "Sixteen Candles".

_Heathers_ may be good, but I was unable to finish watching it. I find
it too painful to watch people behaving stupidly for no good reason.
Similarly, I was unable to finish watching _Bandits_.
 
J

Jeff Shannon

Dan said:
Python does not have a switch/case construct. Your example would
normally be written as an if...elif...else ladder.

Or, in situations where the case conditions can be narrowed to a single
value (possibly with the aid of a custom classification function), one
could use a dictionary dispatch.

def func1():
print "Func1"
def func2():
print "Func2"
def func3():
print "Func3"

dispatcher = { 0: func1, 1: func2, 2: func3 }

i = int(score / 10)
myfunc = dispatcher
myfunc()

This idiom requires a bit more in the way of setup (you're choosing an
object, not a statement, so statements must be wrapped in
functions/classes; the selection criteria must be a hashable value), but
the result is (imho) a much cleaner structure.

Jeff Shannon
Technician/Programmer
Credit International
 
A

Anna Martelli Ravenscroft

Richard said:
Apparently it is not a matter of "smartly" but don't ask at all.

I get the point, grief.

Honey, you ain't seen grief! If you'd posted any *one* question like
that on misc.fitness.weights, you'd have been drawn, quartered, tarred
and feathered, hung out to dry, and THEN they would start getting mean!

Seriously - the feedback you're getting from several posters is that
you're welcome to ask questions, but you need to show that you've done
some work first of your own - you need to show that you've put some
thought and research into it before posting a question. Some are just
laughing or teasing but several honestly trying to help you understand.
Please, don't back off and avoid asking - just learn from the responses
*how* to ask and *when* to ask (i.e, after you've done some research,
reading to learn what you can on your own, and mebbe even tried
something out and then come back and have us help you fix it so it works).

Anna
 
R

Richard Blackwood

Anna said:
Honey, you ain't seen grief! If you'd posted any *one* question like
that on misc.fitness.weights, you'd have been drawn, quartered, tarred
and feathered, hung out to dry, and THEN they would start getting mean!

Seriously - the feedback you're getting from several posters is that
you're welcome to ask questions, but you need to show that you've done
some work first of your own - you need to show that you've put some
thought and research into it before posting a question. Some are just
laughing or teasing but several honestly trying to help you
understand. Please, don't back off and avoid asking - just learn from
the responses *how* to ask and *when* to ask (i.e, after you've done
some research, reading to learn what you can on your own, and mebbe
even tried something out and then come back and have us help you fix
it so it works).

Anna

WOW! Your late on the boat. That is an old post and all is well at
this juncture. Thanks anyway Anna.
 
N

Nicola Larosa

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
...it sounds like Python has most of what I want (though not all).

That which it doesn't have, you'll learn to "unwant" it soon. ;-)

- --
Nicola Larosa - (e-mail address removed)

Python gives you enough rope to hang yourself, but you have to know where
to look. Its land has a dearth of trees, branches or posts to use the rope
to actually hang yourself. And the landscape is so beautiful we don't even
notice most of the time. :) -- Chris on comp.lang.python, July 2004


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBZFxYXv0hgDImBm4RAjxKAJ4xY+H7AOkHmucJ1dZWyofndAt3TwCeOjGe
s8WXvvy9aiRqyUWrYIwWIMU=
=1P1R
-----END PGP SIGNATURE-----
 
A

Anna Martelli Ravenscroft

Richard said:
WOW! Your late on the boat.

LOL - Usually. My slavedriver husband keeps me working too much to keep
up-to-date on c.l.py... ;-)
> That is an old post and all is well at
> this juncture. Thanks anyway Anna.

Glad to see you've caught on and seem to be getting some good questions
and answers.

[Belated] Welcome.

Anna
 
R

Richard Blackwood

Anna said:
Richard said:
WOW! Your late on the boat.


LOL - Usually. My slavedriver husband keeps me working too much to
keep up-to-date on c.l.py... ;-)
That is an old post and all is well at
this juncture. Thanks anyway Anna.

Glad to see you've caught on and seem to be getting some good
questions and answers.

[Belated] Welcome.

Anna

Thanks, and tell your slavedriver husband to stop slavedriving you. ;)
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top