473,405 Members | 2,282 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,405 software developers and data experts.

Metaclass uses?

Hi,

Recently I posted a question about the factory pattern in python. I ve
implemented this following one of the ideas posted. After some reading
I ve seem a lot of Aspect Oriented Programming mentioned but I m not
really sure what it is.

Can anyone help me understand how metaclasses can improve the quality
of my code and let me do better things.

Also is there anymore interesting OO stuff that Python has apart from Java.

Many Thanks

Nathan
Dec 15 '06 #1
3 1038

Nathan Harmston wrote:
Also is there anymore interesting OO stuff that Python has apart from Java.
Duck Typing: http://www.thescripts.com/forum/thread22721.html;
http://mindview.net/WebLog/log-0025,
Python does not have checked exceptions:
http://www.mindview.net/Etc/Discussi...ckedExceptions

- Paddy.

Dec 17 '06 #2
Nathan Harmston wrote:
Hi,

Recently I posted a question about the factory pattern in python. I ve
implemented this following one of the ideas posted. After some reading
I ve seem a lot of Aspect Oriented Programming mentioned but I m not
really sure what it is.

Can anyone help me understand how metaclasses can improve the quality
of my code and let me do better things.
Have you read the two papers in IBMDeveloperWorks about metaclasses?
There is also
a third one, about avoiding metaclasses, which is waiting for
publication. Here is the draft:
http://www.phyast.pitt.edu/~micheles...itializer.html

Michele Simionato

Dec 18 '06 #3
Nathan Harmston a écrit :
(snip)
Also is there anymore interesting OO stuff that Python has apart from Java.
Quite a lot. Everything (well, except statements and expressions...) in
Python is an object, including classes, modules and functions, and
Python objects are really 'dynamic', ie you can modify them at runtime -
and when I say 'modify', I mean things like adding/replacing/removing
attributes, including methods and class (which are attributes too...).
Dec 18 '06 #4

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

Similar topics

5
by: Gustavo Niemeyer | last post by:
Hi everyone! I was just part of a small discussion concerning metaclass features on Python, and one limitation that was appointed was the inability to redefine metaclasses on existent code. Than...
7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
0
by: Robin Becker | last post by:
A colleague wanted to initialize his class __new__ and tried code resembling this #######################1 class Metaclass (type): def __init__(cls, name, bases, *args, **kwargs):...
4
by: Paul Morrow | last post by:
One of the beautiful things about Python is its clear, minimal syntax. So we must resist adding new syntax to the language, especially where there is a reasonable alternative. I believe that...
5
by: Irmen de Jong | last post by:
Hi, I've developed the Metaclass below, because I needed a way to make a bunch of classes thread-safe. I didn't want to change every method of the class by adding lock.aqcuire()..lock.release()...
33
by: Jacek Generowicz | last post by:
I would like to write a metaclass which would allow me to overload names in the definition of its instances, like this class Foo(object): __metaclass__ = OverloadingClass att = 1 att = 3
16
by: ironfroggy | last post by:
Hoping this isn't seeming too confusing, but I need to create a metaclass and a class using that metaclass, such that one of the bases of the metaclass is the class created with that metaclass. I...
14
by: Pedro Werneck | last post by:
Hi I have a class A, with metaclass M_A, and class B, subclass of A, with metaclass M_B, subclass of M_A. A class C, subclass of B must have M_B or a subclass of it as metaclass, but what if...
9
by: Christian Eder | last post by:
Hi, I think I have discovered a problem in context of metaclasses and multiple inheritance in python 2.4, which I could finally reduce to a simple example: Look at following code: class...
4
by: Pedro Werneck | last post by:
Hi all I noticed something strange here while explaining decorators to someone. Not any real use code, but I think it's worth mentioning. When I access a class attribute, on a class with a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.