Hello, I have a code here that I’m having a problem with. It’s supposed to be a
pizza ordering simulator, as you can tell by the title, but I keep trying to
add music to it and whenever I try to play the music with the program running,
it always freezes up and crashes. Can someone help me with t
On 05/07/16 01:42, Steven D'Aprano wrote:
> On Tue, Jul 05, 2016 at 12:47:27AM +0100, Alan Gauld via Tutor wrote:
>
>>> I then tried using
>>>
>>> elif keycode == 27:
>>>
>>> but this statement didn't work.
>>
>> I'm not sure why that didn't work.
>> What exactly happened? Did you get a different
On 05/07/16 04:36, Frank Lawrence wrote:
> Hello, I have a code here that I’m having a problem with.
Unfortunately we can't see it.
Now, I could see it among a bunch of HTML when I checked it in the
moderator queue, so I'm guessing you sent it as some kind of
attachment and the server has stripp
Hi list,
I've read three or four articles on creating decorators. I don't know why,
but the use of decorators makes sense, yet the creation of them isn't
clicking. I get the idea, but when it comes to precisely how to write
one--what goes where and gets returned/called when--it's just not making
co
On 05/07/16 14:22, Alex Hall wrote:
> To simplify things, what might be an example of a decorator that, say,
> prints "decorated" before whatever string the decorated function prints?
> My attempt would be:
>
> def prependDecorated(f):
> def prepend():
> return "decorated"+f()
> #somethi
On Tue, Jul 05, 2016 at 09:22:52AM -0400, Alex Hall wrote:
> Hi list,
> I've read three or four articles on creating decorators. I don't know why,
> but the use of decorators makes sense, yet the creation of them isn't
> clicking. I get the idea, but when it comes to precisely how to write
> one--w
Sorry for top posting, but yes excepting you don't need the parens after
log in the @log line.
Sent from my Fonepad
Alex Hall wrote:
Okay, I think I follow. So a decorator to log that a function ran might
be:
import utils
@log()
def run():
** #do things
#util
On Tue, Jul 5, 2016 at 1:26 PM, Alan G wrote:
> Sorry for top posting, but yes excepting you don't need the parens after
> log in the @log line.
>
For decorators, do you never include parentheses except for passing
arguments? It seems a bit odd to drop them if they'd be empty, given that
anywher
On Sat, Jul 2, 2016 at 8:29 AM Alan Gauld via Tutor
wrote:
> There are arguably easier ways of doing this
>
I think you'll find that for-loops are preferable to while-loops. Here's an
alternative implementation.
https://gist.github.com/selik/d8e0a7622ceff0fe8984a7d19d44bfca
import random
Hi all,
Thanks for all the help regarding decorators. It makes more sense now.
I was double checking that I remembered the isinstance order of arguments
correctly by using the command line interpreter, and found something very
odd.
>>> a = 5
>>> isinstance(a, int)
True
>>> a is int
False
What ha
On Tue, Jul 5, 2016 at 3:05 PM, Alex Hall wrote:
> Hi all,
> Thanks for all the help regarding decorators. It makes more sense now.
>
> I was double checking that I remembered the isinstance order of arguments
> correctly by using the command line interpreter, and found something very
> odd.
>
>>>
On 05/07/16 18:31, Alex Hall wrote:
> For decorators, do you never include parentheses except for passing
> arguments? It seems a bit odd to drop them if they'd be empty, given that
> anywhere else doing so would return the function object rather than call
> it.
Remember what the @ sign is doing
On 05/07/16 20:05, Alex Hall wrote:
> I was double checking that I remembered the isinstance order of arguments
> correctly by using the command line interpreter, and found something very
> odd.
>
a = 5
isinstance(a, int)
> True
a is int
> False
>
> What happened there? Don't thes
On 06/07/16 00:06, Alan Gauld via Tutor wrote:
> func = decorator(func)
>
> If you write @decorator()
>
> That translates to
>
> @decorator()(func)
Ooops, I meant to say
func = decorator()(func)
Sorry.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.ama
On Tue, Jul 5, 2016 at 12:05 PM, Alex Hall wrote:
a = 5
isinstance(a, int)
> True
a is int
> False
>
> What happened there? Don't these do the same thing? I thought I could use
> them interchangeably?
'isinstance' is something else from 'is'.
isinstance will tell us if something
hey everyone. this is my first time trying this -- actually, I've been
studying python only for some days now, and I'm afraid my questions are going
to be rally simple, but I can't seem to understand this piece of code and
thus can't move on.
you probably know the book, so you know that zed
On 06/07/16 00:22, Alan Gauld via Tutor wrote:
type(c) is C
> True
type(d) is type(C)
> False
The last one should of course be
>>> type(d) is C
False
Apologies.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow
Welcome!
On 07/05/2016 06:56 PM, loh...@tuta.io wrote:
hey everyone. this is my first time trying this -- actually, I've been
studying python only for some days now, and I'm afraid my questions are going
to be rally simple, but I can't seem to understand this piece of code and
thus can't mov
On Tue, Jul 05, 2016 at 03:05:45PM -0400, Alex Hall wrote:
> >>> a = 5
> >>> isinstance(a, int)
> True
> >>> a is int
> False
>
> What happened there? Don't these do the same thing? I thought I could use
> them interchangeably?
You're probably thinking of "is a", as in, "5 is an int", "'Hello
W
Hi Heloisa, and welcome.
Do you have a link to the code? Or better still, if it is short (say
under fifty lines) can you copy it into an email and send it?
On Wed, Jul 06, 2016 at 12:56:19AM +0100, loh...@tuta.io wrote:
[...]
> 1. the need to put script into an estipulation for argv (line 3)
I
20 matches
Mail list logo