473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What's with the @ sign

What's with code that has the @ symbol in front of classes or
functions? This has probably already been asked but I can't find any
info on it.

Here is a slice of code I found that uses this, can someone please
explain what the @'s for??
::

def option_error_decorator(func):
def wrapper(*a, **k):
try:
return func(*a, **k)
except _socket.error, (errno, info):
raise SocketOptionError(errno, info)
return wrapper

def BoolOption(level, option):
@option_error_decorator
def getter(self):
return bool(self._sock.getsockopt(level, option))
@option_error_decorator
def setter(self, value):
return self._sock.setsockopt(level, option, int(value))
return property(getter, setter)
::

Thanks in advance,
Jordan

May 23 '06 #1
4 1193
Oh please, please, can I answer!

They are decorators.
Check-out http://zephyrfalcon.org/weblog2/arch...0610.html#e610
(decorate this),
or http://paddy3118.blogspot.com/ " Python function attributes" and
then " Function Attributes assigned by decorator".

Of course there is also:
http://wiki.python.org/moin/PythonDecoratorLibrary

- Pad.

May 23 '06 #2
Oh please, please, can I answer!

They are decorators.
Check-out http://zephyrfalcon.org/weblog2/arch...0610.html#e610
(decorate this),
or http://paddy3118.blogspot.com/ " Python function attributes" and
then " Function Attributes assigned by decorator".

Of course there is also:
http://wiki.python.org/moin/PythonDecoratorLibrary

- Pad.

May 23 '06 #3
jo************@gmail.com wrote:
What's with code that has the @ symbol in front of classes or
functions? This has probably already been asked but I can't find any
info on it.


http://www.python.org/doc/2.4.2/whatsnew/node6.html

May 23 '06 #4
Thanks!
I had no clue what that was (and searching for @ in the context of
python was returning hundreds of thousands of hits XD)

May 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John Dunlop | last post by:
Q: What does @ (at-sign) do? A: @ is an operator, which, when prepended to an expression, suppresses error messages. Example: ...
9
by: cooldv | last post by:
i know how to replace the sign " when SUBMITTING a form in asp by this code: message = Replace(usermessage, "'", "''"). My problem is DISPLAYING data in an asp FORM, from an an access database,...
2
by: Don Clark | last post by:
Hello; Admittedly, I'm very new to HTML, and this is my first post to any newsgroup, so please go easy. I was looking at the html code for an email I received and noted an href statement that...
2
by: greatbooksclassics | last post by:
Open Source DRM? What does everyone think about it? Will Open Source DRM ever catch up to MS DRM? Will DRM ever be integrated into common LAMP applications?...
4
by: Chris | last post by:
I am trying to compile my project with 'Microsoft.Practices.EnterpriseLibrary.Data' and I am getting the error message 'Microsoft.Practices.EnterpriseLibrary.Data' does not have a strong name....
8
by: werner | last post by:
Hi! I don't want to use eval() in order to parse a user-supplied formula. What alternatives do I have? PHP has no standard functionality for tokenizing or parsing expressions in this regard. ...
6
by: Steve K. | last post by:
I recall a few months ago coming across an article allowing for encoding (or converting?) xml and html documents into sign language as well as brail for deaf and blind people, and that they were...
15
by: robert maas, see http://tinyurl.com/uh3t | last post by:
Here's the source: #include <stdio.h> #include <errno.h> main () { char* str = "9999999999"; long long int llin; char* endptr; /* Set by strtoll */ int nch; errno = 0; llin = strtoll(str,...
2
by: Terry Chapman | last post by:
I have a 2003 Access .mda add-in which I can sign using my Thawte digital certificate. I am now migrating this add-in to Access 2007 and when I try to add my Thawte digital signature Access 2007...
20
by: Ravikiran | last post by:
Hi Friends, I wanted know about whatt is ment by zero optimization and sign optimization and its differences.... Thank you...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.