Hi
It turns out I should have used
t=turtle.Pen()
and not
t=turtle.pen()
My stupid mistake!
"Neil" wrote in message
news:jyydnb8xe8hpoghunz2dnuvz8juwn...@bt.com...
> Thanks everyone!
>
> It appears the info in the book is wrong. Trying what you have all
> suggested
> has got it to work!
>
Thanks everyone!
It appears the info in the book is wrong. Trying what you have all suggested
has got it to work!
Many thanks, and I am sure I will be back here again with other newbie
problems!
Neil
"Neil" wrote in message
news:ifidnr_gysdmfqhunz2dnekdnzzin...@bt.com...
> Hello
>
> Sorry if
On Feb 18, 4:16 pm, "Neil" wrote:
> Hello
>
> Sorry if this is not an appropriate newsgroup for this problem. I am very
> new to Python but not new to programming.
>
> I am hoping to use Python to teach a class and have been looking at the
> online book 'Snake Wrangling for Kids'.
>
> I have follo
Neil wrote:
Forgot to say, that after the error message the turtle window 'hangs' as
unresponsive ...
"Neil" wrote in message
news:ifidnr_gysdmfqhunz2dnekdnzzin...@bt.com...
Hello
I am hoping to use Python to teach a class and have been looking at the
online book 'Snake Wrangling for Kids'.
Thanks for the very speedy reply!
Not sure what your reply means but I have emailed the author with the
problem!
Cheers
Neil
"sjbrown" wrote in message
news:9ba48cb7-d32b-40ef-a6a6-d22508863...@l33g2000pri.googlegroups.com...
It looks like there may be a bug if you were expecting t to be som
It looks like there may be a bug if you were expecting t to be some
object other than a dict. You can apparently contact the authour
here:
http://www.briggs.net.nz/log/contact/
On Feb 18, 2:16 pm, "Neil" wrote:
> Hello
>
> Sorry if this is not an appropriate newsgroup for this problem. I am ver
Forgot to say, that after the error message the turtle window 'hangs' as
unresponsive ...
"Neil" wrote in message
news:ifidnr_gysdmfqhunz2dnekdnzzin...@bt.com...
> Hello
>
> Sorry if this is not an appropriate newsgroup for this problem. I am very
> new to Python but not new to programming.
>
On 12/01/08 00:23 +0100, Hrvoje Niksic wrote:
> "Faber J. Fedor" <[EMAIL PROTECTED]> writes:
> > Does this '("" if not where...' syntax actually work?
>
> http://docs.python.org/whatsnew/pep-308.html
C'mon! I'm in Day Two of learning Python. You can't expect me to be
reading "What's New" docs a
On 11/01/08 18:29 -0500, Mike Meyer wrote:
> It is a 2.5 feature, though.
I was beginning to wonder of that was the case.
> I converted all my clients to 2.5.1,
> shortly after it was available, and haven't used anything older
> since. Sorry 'bout that.
No prob.
--
Regards,
Faber Fedor
"Faber J. Fedor" <[EMAIL PROTECTED]> writes:
> On 10/01/08 22:53 -0500, Mike Meyer wrote:
>> Personally, I think it would be more pythonic to not try and use two
>> different APIs to walk the list of jobs (... One Way To Do it):
>>
>> def __call__(self, where=None):
>> q = "select * from %s"
On Fri, 11 Jan 2008 18:11:41 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote:
> On 10/01/08 22:53 -0500, Mike Meyer wrote:
> > Personally, I think it would be more pythonic to not try and use two
> > different APIs to walk the list of jobs (... One Way To Do it):
> >
> > def __call__(self, where
On 10/01/08 22:53 -0500, Mike Meyer wrote:
> Personally, I think it would be more pythonic to not try and use two
> different APIs to walk the list of jobs (... One Way To Do it):
>
> def __call__(self, where=None):
> q = "select * from %s" % (self.name,) + ("" if not where else (" where
> %s
On Thu, 10 Jan 2008 20:32:06 -0500 "Faber J. Fedor" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm in the process of learning Python by writing a job queue program.
> Nothing fancy, mind you, just read from a table, shell out to a program,
> write back to the table.
>
> I'm working off of the tuto
On Mon, 19 Nov 2007 16:06:36 -0500, Sells, Fred wrote:
>> >>> a, b = [], []
>> >>> a.append(b)
>> >>> b.append(a)
> did you perhaps mean a.append('b'); b.append('a'); otherwise this seems
> pretty advanced for a newbie
If you had bothered to read the rest of the post, you'd see that he meant
exa
> >>> a, b = [], []
> >>> a.append(b)
> >>> b.append(a)
did you perhaps mean a.append('b'); b.append('a'); otherwise this seems pretty
advanced for a newbie
> >>> b in a
> True
> >>> a in a
> Traceback (most recent call last):
> File "", line 1, in
> RuntimeError: maximum recursion depth exce
En Mon, 19 Nov 2007 03:32:12 -0300, saccade <[EMAIL PROTECTED]> escribió:
> So if I am permitted to think of integers as immutable objects with
> predefined labels (i.e. the integers used in the text of the program
> code) that cannot de or re referenced then what a similar treatment of
> characte
>
> On Nov 17, 4:35 am, John Machin <[EMAIL PROTECTED]> wrote:
>> Worse: Consider z = ['A1', 'Z9']. It's highly likely that when x ==
>> 'A1', "x is_in z" is True -- because an unguaranteed implementation-
>> dependent caper caches or "interns" some values, so that x and z[0]
>> are the same objec
On Nov 19, 12:32 am, saccade <[EMAIL PROTECTED]> wrote:
> I am not a programmer so I feel odd commenting about language design
> decisions. When my Prof. introduced python the first question that
> popped into mind was that since "x=9; y=9; print x is y and x == y"
> prints "True" is there a way t
On Nov 17, 3:40 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
>
> You can write your own membership test based on identity ('is'):
>
Thank you for the practical (usable) advice and explanation of the
'==' operator.
On Nov 17, 4:35 am, John Machin <[EMAIL PROTECTED]> wrote:
>
> And that can
On Nov 17, 6:02 pm, saccade <[EMAIL PROTECTED]> wrote:
> >>> a, b = [], []
> >>> a.append(b)
> >>> b.append(a)
> >>> b in a
> True
> >>> a in a
>
> Traceback (most recent call last):
> File "", line 1, in
> RuntimeError: maximum recursion depth exceeded in cmp
>
> >>> a is a[0]
> False
> >>> a =
En Sat, 17 Nov 2007 04:02:12 -0300, saccade <[EMAIL PROTECTED]> escribió:
a, b = [], []
a.append(b)
b.append(a)
b in a
> True
a in a
> Traceback (most recent call last):
> File "", line 1, in
> RuntimeError: maximum recursion depth exceeded in cmp
a is a[0]
>
On 2006-08-02, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
>> I find that a strange purpose because when you are working on a class,
>> you don't necessarily know if you will ever know many instance of that
>> class. So should I use __slots__ in all my classes, just to be sure
>> for when someone w
In <[EMAIL PROTECTED]>, Antoon Pardon wrote:
> On 2006-07-28, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> This avoids the problem but you get others in return. And it's an
>> abuse of `__slots__` which is meant as a way to save memory if you need
>> really many objects of that type an
> I find that a strange purpose because when you are working on a class,
> you don't necessarily know if you will ever know many instance of that
> class. So should I use __slots__ in all my classes, just to be sure
> for when someone wants many instances of one?
I find that a strange reasoning b
On 2006-07-28, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>>
>> class MyClass(object):
>>
>> __slots__ = ('bar',)
>>
>> def func(self):
>> return 123
>>
>> x = MyClass()
>> x.instance_var_not_defined_in_the_class = 456
>> ==>
>> AttributeError: 'MyClass' object has no a
Ben Sizer wrote:
> Ray wrote:
> But remember, at no point did they think to make that stuff
> deliberately hard so that it would give you safety. It's hard because
> the implementation is relatively complex. The flipside of that is
> writing function objects in C++, which are an ugly hack to get a
Ray wrote:
> Yeah, I know... but the thing is that it's easy to "do it". Say in C++,
> you can rebind the method of a class to another function if you want
> to, you can muck around with the vtable and stuff, but you've gotta do
> something different than, say, a normal assignment.
But remember, a
Bruno Desthuilliers wrote:
> Ray wrote:
> > Bruno Desthuilliers wrote:
> > Actually Bruno, don't you think that the notion of flexibility in
> > Python comes at the expense of "security" is simply due to the fact
> > that the syntax of "screw up" is exactly the same as the syntax of "I
> > mean it
In <[EMAIL PROTECTED]>, Timo wrote:
> Steve Jobless kirjoitti:
>
>> Let's say the class is defined as:
>>
>> class MyClass:
>> def __init__(self):
>> pass
>> def func(self):
>> return 123
>>
>> But from the outside of the class my interpreter let me do:
>>
>> x = MyClass()
Ray wrote:
> Bruno Desthuilliers wrote:
>>> I'd rather let a machine to do that. Wasn't computer created for tasks
>>> like this? (No, not really. But...)
>> There's obviously a trade-off between 'security' and flexibility. As I
>> said, I do make lots of typo too, but OTOH the edit/test cycle in P
Steve Jobless wrote:
> Bruno Desthuilliers wrote:
>> Steve Jobless wrote:
>>> Sybren Stuvel wrote:
>>>
Steve Jobless enlightened us with:
> The first case can be just a typo, like:
>
> x.valeu = 5
>
> I make typos all the time. Without a spell checker, this message
>>
Steve Jobless wrote:
> Unfortunately, I don't see a way
> to separate interface from implementation in Python. So, it may not make
> much difference whether you subclass it or hack it from the outside.
Documentation. (And name-mangling, underscore prepending, all the stuff
the others said.) Whenev
Steve Jobless kirjoitti:
> Let's say the class is defined as:
>
> class MyClass:
> def __init__(self):
> pass
> def func(self):
> return 123
>
> But from the outside of the class my interpreter let me do:
>
> x = MyClass()
> x.instance_var_not_defined_in_the_class = 456
>
Ben Sizer wrote:
> Ray wrote:
> > Actually Bruno, don't you think that the notion of flexibility in
> > Python comes at the expense of "security" is simply due to the fact
> > that the syntax of "screw up" is exactly the same as the syntax of "I
> > mean it this way and I do want it"?
> >
> > Per
Ray wrote:
> Actually Bruno, don't you think that the notion of flexibility in
> Python comes at the expense of "security" is simply due to the fact
> that the syntax of "screw up" is exactly the same as the syntax of "I
> mean it this way and I do want it"?
>
> Perhaps if we use a different synta
In <[EMAIL PROTECTED]>, Steve Jobless wrote:
> Bruno Desthuilliers wrote:
>>
>> Steve Jobless wrote:
>> > But what about adding a method to the class? Am I supposed to ask "Is
>> > anyone using name xxx?"
>>
>> assert 'xxx' not in dir(SomeClassOrObject)
>>
>> > The class may be used by develop
Bruno Desthuilliers wrote:
> > I'd rather let a machine to do that. Wasn't computer created for tasks
> > like this? (No, not really. But...)
>
> There's obviously a trade-off between 'security' and flexibility. As I
> said, I do make lots of typo too, but OTOH the edit/test cycle in Python
> is u
Bruno Desthuilliers wrote:
>
> Steve Jobless wrote:
> > Sybren Stuvel wrote:
> >
> >>Steve Jobless enlightened us with:
> >>
> >>>The first case can be just a typo, like:
> >>>
> >>> x.valeu = 5
> >>>
> >>>I make typos all the time. Without a spell checker, this message
> >>>would be unreadable :
Steve Jobless wrote:
> Sybren Stuvel wrote:
> >
> > Steve Jobless enlightened us with:
> > > The first case can be just a typo, like:
> > >
> > > x.valeu = 5
> > >
> > > I make typos all the time. Without a spell checker, this message
> > > would be unreadable :).
> >
> > Then learn to read what
Bruno Desthuilliers wrote:
> Ray wrote:
> Ray, please, don't top-post
Um, top-post? I'm using Google News and it looks like it is placed
correctly in the thread... or you're referring to a different thing?
Ray
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> Ray wrote:
>
> > The argument against this is that since development with Python is so
> > rapid, you're supposed to always equip your code with extensive unit
> > tests. I like Python but I've never really bought that argument--I
> > guess I've been doing Java too long :)
> >
Sybren Stuvel wrote:
> Ray enlightened us with:
> > Huh? No. The compiler will always tell you. Have you ever tried Java
> > before?
>
> I know what I'm talking about, I've got a degree in Computer Science
> from the University of Amsterdam.
Then how come you didn't know that the Java compiler wi
Steve Jobless wrote:
> Sybren Stuvel wrote:
>
>>Steve Jobless enlightened us with:
>>
>>>The first case can be just a typo, like:
>>>
>>> x.valeu = 5
>>>
>>>I make typos all the time. Without a spell checker, this message
>>>would be unreadable :).
>>
>>Then learn to read what you type, as you ty
Ray wrote:
> The argument against this is that since development with Python is so
> rapid, you're supposed to always equip your code with extensive unit
> tests. I like Python but I've never really bought that argument--I
> guess I've been doing Java too long :)
>
In Java, if you don't always e
Ray wrote:
Ray, please, don't top-post
(snip)
> Also having to check whether a name has already existed can be a major
> pain in the butt with Python.
assert 'somename' not in dir(someObject)
(snip)
> Regarding the lack of privacy,
s/privacy/language-inforced access restriction/
> --I guess
Sybren Stuvel wrote:
> Ray enlightened us with:
> > Also having to check whether a name has already existed can be a
> > major pain in the butt with Python. With Java you always know when a
> > name has already existed, and what type is bound to the name. I
> > consider this to be a Good Thing (tm
Hey Steve,
Yes, I agree with you. The lack of checking can get confusing fast.
It's not about typing without errors. Regardless of how you train as
long as you're human you WILL make typos.
Also having to check whether a name has already existed can be a major
pain in the butt with Python. With J
Sybren Stuvel wrote:
>
> Steve Jobless enlightened us with:
> > The first case can be just a typo, like:
> >
> > x.valeu = 5
> >
> > I make typos all the time. Without a spell checker, this message
> > would be unreadable :).
>
> Then learn to read what you type, as you type it. Typing without
Steve Jobless:
> I'm hearing that "they are features, but don't use them."
You can use them if you know why you are doing it.
You can also take a look at PyChecker and PyLint, they may help you.
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
On 7/26/06, Steve Jobless <[EMAIL PROTECTED]> wrote:
> If I was working on a large project with many engineers, I'd assume
> someone will do things like this sooner or later. I've seen many
> horrendous code in my life and I have no control over who I work with.
If you work with cowboys, not P
Steve Jobless wrote:
>
> Hi,
>
> I just started learning Python. I went through most of the tutorial at
> python.org. But I noticed something weird. I'm not talking about the
> __private hack.
>
> Let's say the class is defined as:
>
> class MyClass:
> def __init__(self):
> pass
>
Steve Jobless wrote:
> Hi,
>
> I just started learning Python. I went through most of the tutorial at
> python.org. But I noticed something weird. I'm not talking about the
> __private hack.
Actually this is __ultra_private. For normal privacy, _private is enough !-)
> Let's say the class is def
Steve Jobless wrote:
> Hi,
>
> I just started learning Python. I went through most of the tutorial at
> python.org. But I noticed something weird. I'm not talking about the
> __private hack.
>
> Let's say the class is defined as:
>
> class MyClass:
> def __init__(self):
> pass
> def
See:
http://redhanded.hobix.com/inspect/monkeypytching.html
Shouldn't be done unless you have a really cool reason for doing so.
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 25 Jul 2006 02:49:06 GMT, Steve Jobless <[EMAIL PROTECTED]> wrote:
>Hi,
>
>I just started learning Python. I went through most of the tutorial at
>python.org. But I noticed something weird. I'm not talking about the
>__private hack.
>
>Let's say the class is defined as:
>
> class MyClass:
Well, my Perl way of doing it would be to have all attributes in a dict
(hash), then create the accessor vi a dynamic function. I knew Python
would have a right way to do it for Python, but when I went looking I
neglected to look at the core of the language. I suppose I'm just too
accustomed to the
Ben Wilson <[EMAIL PROTECTED]> wrote:
>I would like to dynamically assign object attributes:
>
>dict = {
> a : 1,
> b : 2,
>}
>
>for key,val in dict :
> obj.key = val
>
>I've googled to no effect, or maybe I'm needing to be hit with the
>appropriately sized clue-by-four.
The conventional clue-by-
No problem. There are, in fact, ugly class-based methods of doing this.
You could assign to an instance's __dict__ dictionary, or -- if the
class is a new-style class -- you can call the __setattr__(self, name,
value) method.
--
http://mail.python.org/mailman/listinfo/python-list
That's it. I should spend more time R-ingTFM. I kept looking for some
class-based solution and there was a built in. Perfectly logical.
Thanks,
Ben
--
http://mail.python.org/mailman/listinfo/python-list
Take a look at the built-in function setattr:
http://ftp.python.org/doc/lib/built-in-funcs.html#l2h-64
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, exactly what I was looking for.
I should go and buy you book ;-)
Bernd
Fredrik Lundh wrote:
> "Bernd" wrote:
>
>
>>I'm on a Linux env and try to get
>>word completion form sdtin done,
>>like Perl's
>> $stdin = Complete( "\t: ", @choices );
>>
>>What I have so far shows me the directory
"Bernd" wrote:
> I'm on a Linux env and try to get
> word completion form sdtin done,
> like Perl's
> $stdin = Complete( "\t: ", @choices );
>
> What I have so far shows me the directory listing
> on the second hit on TAB and not the list of
> choices on the first like I wanted to have.
your com
[EMAIL PROTECTED] wrote:
> Hi,
>
> I want to display a window containing an image and when I move the
> mouse over the image and click on the left Mb, I want to get the
> position of the mouse on the image.
> I listed the code to view the image below (so far so good) but for some
> reason the EVT_
Bengt Richter wrote:
On Thu, 13 Jan 2005 09:16:40 -0500, Steve Holden <[EMAIL PROTECTED]> wrote:
[...]
Any statement of the form
for i in [x for x in something]:
can be rewritten as
for i in something:
Note that this doesn't mean you never want to iterate over a list
comprehension. It's the
On Fri, 14 Jan 2005 00:08:09 GMT, rumours say that [EMAIL PROTECTED] (Bengt
Richter) might have written:
>As I'm sure you know, with 2.4's generator expressions you
>don't have to build the temporary list.
>Which could be important if 'something'
>is (or generates) a huge sequence.
>
> for i
On Thu, 13 Jan 2005 09:16:40 -0500, Steve Holden <[EMAIL PROTECTED]> wrote:
[...]
>
>Any statement of the form
>
> for i in [x for x in something]:
>
>can be rewritten as
>
> for i in something:
>
>Note that this doesn't mean you never want to iterate over a list
>comprehension. It's the e
Egor Bolonev wrote:
"Stephen Thorne" <[EMAIL PROTECTED]> ÑÐÐÐÑÐÐ/ÑÐÐÐÑÐÐÐ Ð
ÑÐÐÐÑÑÑÐÐ: news:[EMAIL PROTECTED]
On Thu, 13 Jan 2005 15:55:10 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote:
how to get rid of 'for' operator in the code?
import os, os.path
def _test():
src = 'C:\\Documents a
I understand you want to do it in an applicative programming style?
Not recommended in general. But here goes:
.# c.l.p. question:
.# "using map, lambda, reduce, filter and List Comprehensions [x for
.# x in []] just don't get how to add string to all elements of list"
.
.##
.# A function that re
On Thu, 13 Jan 2005 17:05:39 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote:
>
> "Stephen Thorne" <[EMAIL PROTECTED]> ÑÐÐÐÑÐÐ/ÑÐÐÐÑÐÐÐ Ð
>
> ÑÐÐÐÑÑÑÐÐ: news:[EMAIL PROTECTED]
> On Thu, 13 Jan 2005 15:55:10 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote:
> > how to get rid of 'for' operator
"Stephen Thorne" <[EMAIL PROTECTED]> ÑÐÐÐÑÐÐ/ÑÐÐÐÑÐÐÐ Ð
ÑÐÐÐÑÑÑÐÐ: news:[EMAIL PROTECTED]
On Thu, 13 Jan 2005 15:55:10 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote:
how to get rid of 'for' operator in the code?
import os, os.path
def _test():
src = 'C:\\Documents and Settings\\ÐÐÐÑ\\M
On Thu, 13 Jan 2005 15:55:10 +1000, Egor Bolonev <[EMAIL PROTECTED]> wrote:
> how to get rid of 'for' operator in the code?
>
> import os, os.path
>
> def _test():
> src = 'C:\\Documents and Settings\\ÐÐÐÑ\\My Documents\\My Music\\'
>
> for i in [x for x in os.listdir(src) if os.path.isf
71 matches
Mail list logo