In article mailman.7297.1393204171.18130.python-l...@python.org,
Mark Lawrence breamore...@yahoo.co.uk wrote:
On 24/02/2014 00:55, alex23 wrote:
On 23/02/2014 3:43 PM, Scott W Dunning wrote:
I had a question regarding functions. Is there a way to call a
function multiple times without
On 2014-02-24, Benjamin Kaplan benjamin.kap...@case.edu wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious indentation error above
On Tue, 25 Feb 2014 02:18:43 -, Dennis Lee Bieber
wlfr...@ix.netcom.com wrote:
On Mon, 24 Feb 2014 01:01:15 -, Rhodri James
rho...@wildebst.org.uk
declaimed the following:
The function range returns the sequence of numbers 1, 2, 3, 4 and 5
[*],
so this has the same effect as
On 26/02/2014 02:06, Cameron Simpson wrote:
On 24Feb2014 13:59, Mark Lawrence breamore...@yahoo.co.uk wrote:
On 24/02/2014 04:01, ru...@yahoo.com wrote:
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23
On 02/25/2014 07:52 PM, Ethan Furman wrote:
On 02/23/2014 08:01 PM, ru...@yahoo.com wrote:
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On
On 24Feb2014 13:59, Mark Lawrence breamore...@yahoo.co.uk wrote:
On 24/02/2014 04:01, ru...@yahoo.com wrote:
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark
On 23Feb2014 18:55, Benjamin Kaplan benjamin.kap...@case.edu wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious indentation error above
On 02/23/2014 08:01 PM, ru...@yahoo.com wrote:
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for
On Sunday, 23 February 2014 05:43:17 UTC, Scott W Dunning wrote:
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a way I
can call a function and then add *5 or something like that?
The following
On Sunday, 23 February 2014 05:43:17 UTC, Scott W Dunning wrote:
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a way I
can call a function and then add *5 or something like that?
The following
On 24/02/2014 04:01, ru...@yahoo.com wrote:
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _
- Original Message -
On Feb 23, 2014, at 1:44 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Sorry, I don't really understand your question. Could you show an
example
of what you are doing?
Do you mean add 5 or *5? Add *5 doesn't really mean anything
Scott W Dunning swdunn...@cox.net writes:
I had a question regarding functions. Is there a way to call a
function multiple times without recalling it over and over.
You should ask question like this on the “python-tutor” forum. I say
that because this question suggests you have yet to learn
On Sat, 22 Feb 2014 22:43:17 -0700, Scott W Dunning wrote:
Hello,
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a
way I can call a function and then add *5 or something like that?
Sorry, I
On 23/02/2014 3:43 PM, Scott W Dunning wrote:
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a way I
can call a function and then add *5 or something like that?
The same way you repeat anything in
On Sun, 23 Feb 2014 05:43:17 -, Scott W Dunning swdunn...@cox.net
wrote:
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a
way I can call a function and then add *5 or something like that?
On 24/02/2014 00:55, alex23 wrote:
On 23/02/2014 3:43 PM, Scott W Dunning wrote:
I had a question regarding functions. Is there a way to call a
function multiple times without recalling it over and over. Meaning
is there a way I can call a function and then add *5 or something like
that?
On Feb 23, 2014, at 1:44 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
Sorry, I don't really understand your question. Could you show an example
of what you are doing?
Do you mean add 5 or *5? Add *5 doesn't really mean anything to me.
Sorry I forgot to add the code
On Feb 23, 2014, at 17:09, Mark Lawrence breamore...@yahoo.co.uk wrote:
For the benefit of newbies, besides the obvious indentation error above, the
underscore basically acts as a dummy variable. I'll let the language lawyers
give a very detailed, precise description :)
You mean a
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious indentation error above
Stupid cutpaste :(
--
https://mail.python.org/mailman/listinfo/python-list
On Feb 23, 2014, at 12:59 AM, Ben Finney ben+pyt...@benfinney.id.au wrote:
You should ask question like this on the “python-tutor” forum.
Thanks Ben, I wasn’t aware of PythonTutor.
--
https://mail.python.org/mailman/listinfo/python-list
I understood what you meant because I looked up loops in the python
documentation since we haven’t got there yet in school.
On Feb 23, 2014, at 6:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious indentation error above
Stupid cutpaste :(
--
Your message came through fine for me
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious indentation error above
Stupid cutpaste :(
--
On 2014-02-24 03:21, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious
On 02/23/2014 08:21 PM, Mark Lawrence wrote:
On 24/02/2014 02:55, Benjamin Kaplan wrote:
On Sun, Feb 23, 2014 at 5:39 PM, alex23 wuwe...@gmail.com wrote:
On 24/02/2014 11:09 AM, Mark Lawrence wrote:
On 24/02/2014 00:55, alex23 wrote:
for _ in range(5):
func()
the obvious
Hello,
I had a question regarding functions. Is there a way to call a function
multiple times without recalling it over and over. Meaning is there a way I
can call a function and then add *5 or something like that?
Thanks for any help!
Scott
--
i use this code to profile. however for small standard functions it
just says 0 seconds.
so one solution is to run the function a very big number of times(how
big?).
but the bottom code doesnt work, it just runs the same profiling 1
times insetad of running the fucntion 10K
times and evaluate
On Apr 16, 12:35 pm, [EMAIL PROTECTED] wrote:
if __name__==__main__:
try:
from cProfile import run
except:
from profile import run
for x in range(1, 1):
run(power(10,10))
def test1():
for x in xrange(1,1):
test = power(10,10)
if
On Sun, 23 Sep 2007 18:32:28 -0700, Kay Schluehr wrote:
On 22 Sep., 02:14, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Kay Schluehr a crit :
(snip)
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of class based OO but Io couples a
In message [EMAIL PROTECTED], Bryan Olson
wrote:
The keyword lambda sucks. ...
Alonzo Church's calculus used the *symbol*.
The keyword was popularized by LISP, and hence adopted by most other
languages to copy the concept.
In my view, it's no worse than using = for assignment instead of
In message [EMAIL PROTECTED], Cristian
wrote:
I think it would make more sense to have beginners _know_ that functions
are like all other variables ...
Functions are not variables. Though they are values, and can be held in
variables.
In Python, every name is a variable, and can be assigned
In message [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
A question: if you WERE to implement function definitions as normal
expressions, how would you go about embedding it within an expression?
x = map(def a:
line of code
line of code
line of code
Lawrence D'Oliveiro [EMAIL PROTECTED] writes:
The fact that Python has difficulties is purely a demonstration of the
limitations of indentation-controlled syntax, not a criticism of the
concept itself.
Not even. Haskell has indentation syntax (they call it layout)
but can have multi-line
Cristian a écrit :
On Sep 21, 5:21 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Ok, then what about classes ? They also are objects-like-any-other,
after all. So should we have this syntax too ?
MyClass = class(ParentClass):
__init__ = function (self, name):
self.name = name
On Mon, 24 Sep 2007 11:43:59 +0200, Bruno Desthuilliers wrote:
You already can create functions without using the def statement:
Help on class function in module __builtin__:
class function(object)
| function(code, globals[, name[, argdefs[, closure]]])
|
| Create a function
On Mon, 2007-09-24 at 10:05 +, Marc 'BlackJack' Rintsch wrote:
On Mon, 24 Sep 2007 11:43:59 +0200, Bruno Desthuilliers wrote:
You already can create functions without using the def statement:
Help on class function in module __builtin__:
class function(object)
|
On Sep 24, 9:09 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
Python:
class B(object):
def __init__(self):
self.things = list()
def add(self, thing):
self.things.append(thing)
And Io:
B := Object clone do(
init := method(
self things :=
Carsten Haese wrote:
Where the heck does *this* come from? Neither Python 2.5.1 nor the
3.0alpha has this in `__builtin__`.
It comes from the 'new' module:
import new
help(new.function)
Help on class function in module __builtin__:
...
Oddly enough, the help misrepresents which
Carsten Haese [EMAIL PROTECTED] wrote:
It comes from the 'new' module:
import new
help(new.function)
Help on class function in module __builtin__:
...
Oddly enough, the help misrepresents which module the function is coming
from.
No, I don't think it is misrepresenting anything. The
Steven D'Aprano a écrit :
On Fri, 21 Sep 2007 22:07:55 +, Cristian wrote:
True, there is lambda, but that is very limited. It might be useful for
key arguments, but not much else.
No, lambda is useful for anything that any other function is useful for,
provided that you can write it
Matthew Woodcraft a écrit :
Cristian [EMAIL PROTECTED] wrote:
To me, the biggest setback for new programmers is the different
syntax Python has for creating functions. Instead of the common (and
easy to grasp) syntax of foo = bar Python has the def foo(): syntax.
[...]
in a program like
On Sep 24, 9:16 pm, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
Matthew Woodcraft a écrit :
One reason for the different syntax is that functions, unlike most
other objects, know their own names (which can be shown in tracebacks
and the like).
Nope. They know *one* of their names
NickC a écrit :
On Sep 24, 9:16 pm, Bruno Desthuilliers bruno.
[EMAIL PROTECTED] wrote:
Matthew Woodcraft a écrit :
One reason for the different syntax is that functions, unlike most
other objects, know their own names (which can be shown in tracebacks
and the like).
Nope. They know *one*
On 22 Sep., 23:17, Erik Max Francis [EMAIL PROTECTED] wrote:
The attribute and method (not made distinct in Io; they're called
slots) is much the same as with Python; the current instance is
checked for the object, then its parents, then _its_ parents, and so on.
Repeating the same point as
Scott David Daniels wrote:
Ron Adam wrote:
Scott David Daniels wrote:
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend.
Here's an idea:
import math
def sin_integral(start, finish, dx): ...
def
Ron Adam wrote:
Scott David Daniels wrote:
Ron Adam wrote:
How about this?
def integrate(fn, x1, x2, n=100):...
The point was a pedagogic suggestion, ...
I understood your point. I just found it interesting since I've been
trying to extend my math (for use with python) skills in
Cristian a écrit :
(snip)
To me, the biggest setback for new programmers is the different syntax
Python has for creating functions. Instead of the common (and easy to
grasp) syntax of foo = bar
It's actually a mostly *un*common syntax when it comes to functions. The
only mainstream language I
Kay Schluehr a écrit :
(snip)
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of class based OO but Io couples a
prototype very closely to its offspring. When A produces B and A.f is
modified after production of B also B.f is modified.
Kay Schluehr a écrit :
On 22 Sep., 23:17, Erik Max Francis [EMAIL PROTECTED] wrote:
The attribute and method (not made distinct in Io; they're called
slots) is much the same as with Python; the current instance is
checked for the object, then its parents, then _its_ parents, and so on.
Cristian a écrit :
On Sep 21, 4:47 pm, Sean Tierney [EMAIL PROTECTED] wrote:
Just tell him that functions are like all other variables and can
therefore be passed by other functions or returned by other functions.
I could Just tell him that functions are like all other variables
Scott David Daniels wrote:
Ron Adam wrote:
Scott David Daniels wrote:
Ron Adam wrote:
How about this?
def integrate(fn, x1, x2, n=100):...
The point was a pedagogic suggestion, ...
I understood your point. I just found it interesting since I've been
trying to extend my math (for
On 22 Sep., 02:14, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Kay Schluehr a écrit :
(snip)
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of class based OO but Io couples a
prototype very closely to its offspring. When A
On Sep 21, 5:21 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:
Ok, then what about classes ? They also are objects-like-any-other,
after all. So should we have this syntax too ?
MyClass = class(ParentClass):
__init__ = function (self, name):
self.name = name
?-)
For consistency
On Fri, 21 Sep 2007 19:52:41 -0400, Carl Banks wrote:
First of all, let me say that I think functions as first class data is
helpful, but not crucial, to programming in Python, and there are many
people who simply don't need the lesson. Especially someone like an
engineer (in the
Carl Banks [EMAIL PROTECTED] writes:
Especially someone like an
engineer (in the classical sense), who isn't building versatile software
packages, won't need to resort to functional programming much.
http://www.math.chalmers.se/~rjmh/Papers/whyfp.html
--
On 22 Sep., 00:36, Cristian [EMAIL PROTECTED] wrote:
Yeah, I agree, that does look pretty ugly. Correct me if I'm wrong,
but I thought the way Python determines a block is by the whitespace
of the first line. So, as long as the spacing (or !tabbing!) is
consistent from line to line the parser
Kay Schluehr [EMAIL PROTECTED] writes:
If you feel you can transform it into another unambigous grammar
mixing statements and expressions it's up to you.
We got rid of the print statement for python 3.0. Why not get rid
of the rest of them too? Just use expressions for everything, as
works
Scott David Daniels wrote:
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend.
Here's an idea:
import math
def sin_integral(start, finish, dx):
total = 0.0
y0 = math.sin(start)
On 22 Sep., 08:56, Paul Rubin http://[EMAIL PROTECTED] wrote:
Kay Schluehr [EMAIL PROTECTED] writes:
If you feel you can transform it into another unambigous grammar
mixing statements and expressions it's up to you.
We got rid of the print statement for python 3.0. Why not get rid
of the
On Sat, 22 Sep 2007 00:47:37 -0700, Kay Schluehr wrote:
On 22 Sep., 08:56, Paul Rubin http://[EMAIL PROTECTED] wrote:
Kay Schluehr [EMAIL PROTECTED] writes:
If you feel you can transform it into another unambigous grammar
mixing statements and expressions it's up to you.
We got rid of the
On Fri, 21 Sep 2007 23:38:38 -0700, Paul Rubin wrote:
Carl Banks [EMAIL PROTECTED] writes:
Especially someone like an
engineer (in the classical sense), who isn't building versatile
software packages, won't need to resort to functional programming much.
Carl Banks [EMAIL PROTECTED] writes:
That's it, lost me already. You ever see the kinds of programs
mechanical engineers write? It isn't software.
They do a lot of number crunching. Certainly they can appreciate
higher order functions like integrate(f, x0, x1) to integrate the
function f
On Sep 22, 10:40 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Sat, 22 Sep 2007 00:47:37 -0700, Kay Schluehr wrote:
On 22 Sep., 08:56, Paul Rubin http://[EMAIL PROTECTED] wrote:
Kay Schluehr [EMAIL PROTECTED] writes:
If you feel you can transform it into another unambigous
On Sat, 22 Sep 2007 02:44:35 -0700, Kay Schluehr wrote:
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of class based OO but Io couples a
prototype very closely to its offspring. When A produces B and A.f is
modified after production
On Sat, 22 Sep 2007 02:32:30 -0700, Paul Rubin wrote:
Carl Banks [EMAIL PROTECTED] writes:
That's it, lost me already. You ever see the kinds of programs
mechanical engineers write? It isn't software.
They do a lot of number crunching. Certainly they can appreciate higher
order
On Sep 22, 1:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Sat, 22 Sep 2007 02:44:35 -0700, Kay Schluehr wrote:
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of class based OO but Io couples a
prototype very closely to
Ron Adam wrote:
Scott David Daniels wrote:
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend.
Here's an idea:
import math
def sin_integral(start, finish, dx): ...
def cos_integral(start,
On Sat, 22 Sep 2007 06:58:57 -0700, Kay Schluehr wrote:
On Sep 22, 1:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Sat, 22 Sep 2007 02:44:35 -0700, Kay Schluehr wrote:
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of
[EMAIL PROTECTED] wrote:
There are already anonymous functions in Python.
lambda x, y, z: x + y + z
is the same as:
def _(x, y, z): return x + y + z
They are the same only in special cases:
The special identifier _ is used in the interactive
interpreter to store the result of
Cristian [EMAIL PROTECTED] wrote:
To me, the biggest setback for new programmers is the different
syntax Python has for creating functions. Instead of the common (and
easy to grasp) syntax of foo = bar Python has the def foo(): syntax.
[...]
in a program like Python there doesn't seem to be
Bryan Olson [EMAIL PROTECTED] writes:
[EMAIL PROTECTED] wrote:
There are already anonymous functions in Python.
lambda x, y, z: x + y + z
is the same as:
def _(x, y, z): return x + y + z
They are the same only in special cases:
The special identifier _ is used in the interactive
Cristian wrote:
[...] Specifically, he's having trouble
thinking of functions as first order data (don't worry, I haven't
confused him with such terminology yet).
[...]
And, after we finally
get a hold of first order functions, we appreciate its incorporation
into languages. It would be a
Paul Rubin wrote:
Bryan Olson [EMAIL PROTECTED] writes:
[EMAIL PROTECTED] wrote:
There are already anonymous functions in Python.
lambda x, y, z: x + y + z
is the same as:
def _(x, y, z): return x + y + z
They are the same only in special cases:
The special identifier _ is used in the
Bryan Olson [EMAIL PROTECTED] writes:
How anonymous is that function when we can see that its name is 'h'?
h is out of scope after compose returns, so the function is anonymous
in the sense that there is no symbol bound to the function, through
which you can refer to it.
import math
Kay Schluehr wrote:
I checked out Io once and I disliked it. I expected Io's prototype OO
being just a more flexible variant of class based OO but Io couples a
prototype very closely to its offspring. When A produces B and A.f is
modified after production of B also B.f is modified. A controls
On Sat, 22 Sep 2007 14:09:13 -0700, Paul Rubin wrote:
Nevertheless, def is never a real anonymous function constructor.
Well, def constructs a function with a name, but the function can stay
around after the name goes away, after which I'd say the function is
nameless. One could otherwise
On Sep 21, 5:37 pm, Cristian [EMAIL PROTECTED] wrote:
A friend of mine is an engineer and he's been needing to do more and
more programming as he goes on with is career. I convinced him to
learn Python instead of Perl and he's really started to like it. He
usually comes to me when he can't
A friend of mine is an engineer and he's been needing to do more and
more programming as he goes on with is career. I convinced him to
learn Python instead of Perl and he's really started to like it. He
usually comes to me when he can't accomplish a task with his current
knowledge and I introduce
On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote:
There are already anonymous functions in Python.
lambda x, y, z: x + y + z
is the same as:
def _(x, y, z): return x + y + z
As for the method stuff, check out staticmethod(). If you assign
staticmethod(function here) to an object, it will be
On Sep 21, 6:07 pm, Cristian [EMAIL PROTECTED] wrote:
On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote:
There are already anonymous functions in Python.
lambda x, y, z: x + y + z
is the same as:
def _(x, y, z): return x + y + z
As for the method stuff, check out staticmethod(). If you
On Sep 21, 3:22 pm, [EMAIL PROTECTED] wrote:
On Sep 21, 6:07 pm, Cristian [EMAIL PROTECTED] wrote:
On Sep 21, 2:48 pm, [EMAIL PROTECTED] wrote:
There are already anonymous functions in Python.
lambda x, y, z: x + y + z
is the same as:
def _(x, y, z): return x + y + z
As
Cristian wrote:
My hope is to subtly reinforce the notion that functions are data
and can be passed around. The current function declaration doesn't
help with this. Creating a function and assigning it to a name is
exactly what Python does, why not have it come out in the syntax? It's
not
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend. How
a name is not the object it self, like a variable is in other languages.
For example show him how an object can have more than one name. And discus
how names can
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend. How
a name is not the object it self, like a variable is in other languages.
For example show him how an object can have more than one name. And
In article [EMAIL PROTECTED],
Cristian [EMAIL PROTECTED] wrote:
...
To someone who's learning to program wouldn't a syntax like the
further give them all they need and also reinforces the idea that
functions are data just like everything else?
my_function = function(foo, bar): pass
Just tell him that functions are like all other variables and can
therefore be passed by other functions or returned by other functions.
If your friend understands variables and functions and he can't make
the leap (and assuming you're right, of course) then your friend
doesn't understand
On 9/21/07, Sean Tierney [EMAIL PROTECTED] wrote:
Just tell him that functions are like all other variables and can
therefore be passed by other functions or returned by other functions.
If your friend understands variables and functions and he can't make
the leap (and assuming you're
On Sep 21, 4:27 pm, J. Cliff Dyer [EMAIL PROTECTED] wrote:
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend. How
a name is not the object it self, like a variable is in other languages.
For
On Sep 21, 4:47 pm, Sean Tierney [EMAIL PROTECTED] wrote:
Just tell him that functions are like all other variables and can
therefore be passed by other functions or returned by other functions.
I could Just tell him that functions are like all other variables
and can
therefore be passed
On Fri, 21 Sep 2007 21:37:18 +, Cristian wrote:
Although his learning experience has gone mostly smoothly, he's hit a
lot of speed bumps with functions. Specifically, he's having trouble
thinking of functions as first order data (don't worry, I haven't
confused him with such terminology
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend. How
a name is not the object it self, like a variable is in other languages.
For example show him how an object can have more than one name. And
On Fri, 21 Sep 2007 22:07:55 +, Cristian wrote:
True, there is lambda, but that is very limited. It might be useful for
key arguments, but not much else.
No, lambda is useful for anything that any other function is useful for,
provided that you can write it as a single expression and not
Cristian wrote:
On Sep 21, 3:44 pm, Ron Adam [EMAIL PROTECTED] wrote:
I think key may be to discuss names and name binding with your friend.
Here's an idea:
import math
def sin_integral(start, finish, dx):
total = 0.0
y0 = math.sin(start)
for n in range(1, 1 + int((finish -
94 matches
Mail list logo