On 1/31/2010 4:17 PM, _wolf wrote:
but why does ``__builtins__`` change its meaning depending on whether
this is the scope of the ‘script’ (i.e. the module whose name was
present, when calling ``python foobar.py``) or whether this is the
scope of a secondary module (imported or executed, directl
Steven D'Aprano writes:
> On Sun, 31 Jan 2010 18:47:42 -0600, John Bokma wrote:
>
>> Steven D'Aprano writes:
>>
>>> On Sun, 31 Jan 2010 14:47:08 -0600, John Bokma wrote:
>>>
An editor can correct the indenting of the braces example but can't
with this one.
if x:
On 1/31/2010 7:25 PM, Steven D'Aprano wrote:
On Sun, 31 Jan 2010 15:40:36 -0800, Chris Rebert wrote:
On Sun, Jan 31, 2010 at 2:36 PM, Steven D'Aprano
wrote:
On Sun, 31 Jan 2010 04:28:41 -0800, Ed Keith wrote:
In most functional languages you just name a function to access it and
you do it A
> I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 -
24. 9. 2009.
> The following script draws 5 circles, which it is supposed to, but then
> doesn't draw the second turtle which is supposed to simply move forward.
> Any ideas?
Try commenting out this statement:
self.turtle.t
Terry Reedy writes:
> Three of you gave essentially identical answers, but I still do not
> see how given something like
>
> def f(): return 1
>
> I differentiate between 'function object at address xxx' and 'int 1'
> objects.
In the languages they are talking about, there is no such thing as a
f
* John Posner:
> I'm on Python 2.5, but using the updated turtle.py Version 1.0.1 -
24. 9. 2009.
> The following script draws 5 circles, which it is supposed to, but then
> doesn't draw the second turtle which is supposed to simply move forward.
> Any ideas?
Try commenting out this stateme
On Sun, Jan 31, 2010 at 8:07 PM, Vern Ceder wrote:
> kirby urner wrote:
>>
>> I don't see where you've defined a Turtle class to instantiate sir.
>
> The Turtle class is part of the turtle library, so that's not an issue.
>
Hey, good point Vern, not firing on all cylinders over here.
So I just c
I've found strange performance issue when using default value, the
test code is list below:
from timeit import Timer
def f(x):
y = x
y.append(1)
return y
def g(x=[]):
y = []
y.append(1)
return y
def h(x=[]):
y = x
y.append(1)
return y
def f2(x):
y = x
y.append(1)
return
keakon wrote:
> def h2(x=[]):
> y = x
> y.append(1)
> return y + []
> h2() is about 42 times slower than h2([]), but h() is a litter faster
> than h([]).
Are you aware that 'y = x' _doesn't_ make a copy of [], that it
actually points to the same list as x?
My guess is that the slowdown yo
On Sun, Jan 31, 2010 at 8:58 PM, keakon wrote:
> I've found strange performance issue when using default value, the
> test code is list below:
>
> from timeit import Timer
>
> def f(x):
> y = x
> y.append(1)
> return y
>
> def g(x=[]):
> y = []
> y.append(1)
> return y
>
> def h(x=[]):
> y
alex23 wrote:
> keakon wrote:
> > def h2(x=[]):
> > y = x
> > y.append(1)
> > return y + []
>
> Are you aware that 'y = x' _doesn't_ make a copy of [], that it
> actually points to the same list as x?
Sorry, I meant to suggest trying the following instead:
def h2(x=None):
if x is None:
On 2月1日, 下午1时20分, alex23 wrote:
> alex23 wrote:
> > keakon wrote:
> > > def h2(x=[]):
> > > y = x
> > > y.append(1)
> > > return y + []
>
> > Are you aware that 'y = x' _doesn't_ make a copy of [], that it
> > actually points to the same list as x?
>
> Sorry, I meant to suggest trying the
keakon wrote:
> The default value is mutable, and can be reused by all each call.
> So each call it will append 1 to the default value, that's very
> different than C++.
Being different from C++ is one of the many reasons some of us choose
Python ;)
This tends to bite most newcomers, so it's men
On Sun, 31 Jan 2010 20:22:36 -0800, Paul Rubin wrote:
> Terry Reedy writes:
>> Three of you gave essentially identical answers, but I still do not see
>> how given something like
>>
>> def f(): return 1
>>
>> I differentiate between 'function object at address xxx' and 'int 1'
>> objects.
>
> In
On Sun, 31 Jan 2010 20:58:50 -0800, keakon wrote:
> I've found strange performance issue when using default value, the test
> code is list below:
>
> from timeit import Timer
>
> def f(x):
> y = x
> y.append(1)
> return y
>
> def g(x=[]):
> y = []
> y.append(1)
> return y
>
> def h
On Sun, 31 Jan 2010 18:53:16 -0600, John Bokma wrote:
> You don't have to buy my argument, I am not selling it.
It's a figure of speech. You are making an argument others have made
before, and I don't accept the validity of the argument.
--
Steven
--
http://mail.python.org/mailman/listinfo/p
Steven D'Aprano writes:
> How would Haskell coders write it? Something like this?
>
> def get_popular_name(url):
> data = fetch url
> names = parse data
> name = choose name 1
> return name
The syntax and types would be different, but ok, something like that.
> name = get_popular
On Sun, 31 Jan 2010 21:30:15 -0600, John Bokma wrote:
> While braces might be considered redundant they are not when for one
> reason or another formatting is lost or done incorrectly.
I've heard this argument before, and I don't buy it. Why should we
expect the editor to co
Steven D'Aprano wrote:
> You're using that term wrong. It looks to me that you don't actually know
> what a straw man argument is. A straw man argument is when somebody
> responds to a deliberately weakened or invalid argument as if it had been
> made by their opponent.
Jeez, Steve, you're beginn
On Sun, Jan 31, 2010 at 10:05 PM, Steven D'Aprano
wrote:
> On Sun, 31 Jan 2010 20:22:36 -0800, Paul Rubin wrote:
>> Terry Reedy writes:
>>> Three of you gave essentially identical answers, but I still do not see
>>> how given something like
>>>
>>> def f(): return 1
>>>
>>> I differentiate betwee
On Sun, 31 Jan 2010 22:43:56 -0800, alex23 wrote:
> Steven D'Aprano wrote:
>> You're using that term wrong. It looks to me that you don't actually
>> know what a straw man argument is. A straw man argument is when
>> somebody responds to a deliberately weakened or invalid argument as if
>> it had
Chris Rebert writes:
> get_popular_name would have the type: IO () -> IO String
I don't know if it makes the explanation any clearer, but I think that
isn't quite right. The Python version would have type
String -> IO String. The parameterless Haskell version would just be an
I/O action, with
101 - 122 of 122 matches
Mail list logo