On Monday 29 December 2008 19:26:50 Jake b wrote:
On Mon, Dec 29, 2008 at 7:07 AM, Joseph Rawson umebos...@gmail.com wrote:
python: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int)
((xcb_req) - (dpy-request)) = 0)' failed.
Is there any more to the message? I would guess its a
so when you do this:
@foo
def bar(): pass
you assume that a function foo() already exists.
and it creates something like this:
def foo():
def bar(): pass
pass
?
I'm sorry, I just got confused.
- On Wed, 12/31/08, Noah Kantrowitz n...@coderanger.net wrote:
From: Noah Kantrowitz
Yanom -
A decorator is a method that takes another method as a parameter so that it can
do something. It is usually used for aspect oriented programming.
For example:
def logThisMethodCall(methodCall)
# Do some logging here
@logThisMethodCall
def myMethod(a,b,c)
# do Somthing in here
O! I get it now! It's used to insure that a specific function is always
called before another. Thanks for clearing it up for me.
--- On Wed, 12/31/08, Michael Phipps michael.phi...@bluetie.com wrote:
From: Michael Phipps michael.phi...@bluetie.com
Subject: Re: [pygame] @
To:
Michael Phipps wrote:
Yanom -
A decorator is a method that takes another method as a parameter so that it can
do something. It is usually used for aspect oriented programming.
For example:
def logThisMethodCall(methodCall)
# Do some logging here
@logThisMethodCall
def myMethod(a,b,c)
While we're on this kind of topic what is the best approach in python to
creating code macros? That is ability to write a higher level language (or
script) which translates down into python? Decorators look like they would
be part of that story. Is that the best way or is their a more general
Joseph Rawson wrote:
Hi,
I am new to using pygame, and I have just started making my first application
with it. I have been tasked to create a slideshow type of application for a
client. Basically, it just displays a picture in the background with a text
message scrolling along the bottom
Sort of. Functions in Python are just objects. They can be passed
around, assigned to variables, and even have attributes added to them. A
decorator is a way to take a newly created function and do something to
it, such as create a new function that calls it. The most common use of
decorators
No, i has nothing to do with runtime. Decorators are evaluated during
class compile.
--Noah
On Dec 31, 2008, at 12:05 PM, Yanom Mobis wrote:
O! I get it now! It's used to insure that a specific function
is always called before another. Thanks for clearing it up for me.
--- On Wed,
Python has no such system. Boo is a python-like language that supports
hygienic macros.
--Noah
On Dec 31, 2008, at 1:20 PM, Lin Parkh wrote:
While we're on this kind of topic what is the best approach in
python to creating code macros? That is ability to write a higher
level language (or
class compile?
Anyway, does it effectively work that way?
--- On Wed, 12/31/08, Noah Kantrowitz n...@coderanger.net wrote:
From: Noah Kantrowitz n...@coderanger.net
Subject: Re: [pygame] @
To: pygame-users@seul.org
Date: Wednesday, December 31, 2008, 1:41 PM
No, i has nothing to do with
No, as I said, decorators are a rather advanced topic. Until you are
more comfortable with the whole compiler process, I would just try
writing a few small ones with various prints to see what happens.
--Noah
On Dec 31, 2008, at 2:57 PM, Yanom Mobis wrote:
class compile?
Anyway, does it
Thanks for the link.
--- On Wed, 12/31/08, Lenard Lindstrom le...@telus.net wrote:
From: Lenard Lindstrom le...@telus.net
Subject: Re: [pygame] @
To: pygame-users@seul.org
Date: Wednesday, December 31, 2008, 1:18 PM
Sort of. Functions in Python are just objects. They can be passed
oh. They showed up in some basic example code for pyglet:
import pyglet
window = pyglet.window.Window()
label = pyglet.text.Label('Hello, world',
font_name='Times New Roman',
font_size=36,
x=window..width//2,
Make sure you have the right version of libsdl installed. I had a
problem like this once when I had the PulseAudio version of SDL
installed when I should have had the ALSA version installed (your
mileage may vary depending on your setup)
---
James Paige
On Tue, Dec 30, 2008 at 03:11:11AM
Thanks. The game context is I would like to write a scripting language on
top of pygame/python for my game.
- Original Message -
From: Lenard Lindstrom le...@telus.net
To: pygame-users@seul.org
Sent: Wednesday, December 31, 2008 1:32 PM
Subject: Re: [pygame] @
This is getting off
Python _is_ the scripting language to use in your game.
--Noah
On Dec 31, 2008, at 4:56 PM, Lin Parkh wrote:
Thanks. The game context is I would like to write a scripting
language on top of pygame/python for my game.
- Original Message - From: Lenard Lindstrom len-
l...@telus.net
A concrete example helps. Unfortunately, knowing how a decorator works
does nothing to explain how it is being used any more than know how to
declare a function tells you what all functions do. Anyway, the key
thing to remember is a function declaration in Python is an executable
statement, a
It is always possible to write game specific languages :-) Like AI
languages.
- Original Message -
From: Noah Kantrowitz n...@coderanger.net
To: pygame-users@seul.org
Sent: Wednesday, December 31, 2008 1:58 PM
Subject: Re: [pygame] @
Python _is_ the scripting language to use in your
Possible, but not needed. I would recommend looking at either TinyPy
or LunaticPython to do safe embedded Python or Lua respectively.
Unless you expect users to running arbitrary downloaded code in your
game, you can just use python+exec though.
--Noah
On Dec 31, 2008, at 7:14 PM, Lin
If it doesn't execute on function call, I don't get what the use is? I
thought if I did this, it would print out I am decorator ( but it
only does it on function declaration )
def dec(f):
print I am decorator!, f
return f
@dec
def fn(x): return x
( And if it doesn't, then the
oh. They showed up in some basic example code for pyglet:
import pyglet
window = pyglet.window.Window()
label = pyglet.text.Label('Hello, world',
font_name='Times New Roman',
font_size=36,
x=window.width//2,
Okay, think about the function classmethod(). It takes a single
callable as an argument and return a callable. You could write this
def make_from_str(cls, data):
newobj = cls()
newobj.parse(data)
return newobj
make_from_str = classmethod(make_from_str)
inside a class.
So doing the same conversion we start with
def a(b): b()
@a
def eggs(): print 'spam'
This becomes:
def a(b): b()
def eggs(): print 'spam'
eggs = a(eggs)
If you look your a() function doesn't return anything so eggs is set
to the default return value which is always None.
--Noah
On Dec
24 matches
Mail list logo