473,786 Members | 2,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What are new-style classes?

I recently heard about 'new-style classes'. I am very sorry if this
sounds like a newbie question, but what are they? I checked the Python
Manual but did not find anything conclusive. Could someone please
enlighten me? Thanks!

Aug 28 '05
12 1593
Reinhold Birkenfeld wrote:
Terry Hancock wrote:
On Tuesday 30 August 2005 04:09 pm, Reinhold Birkenfeld wrote:
The customary way is to use "class new_class(objec t):". There's no advantage in using
__metaclass_ _ except that you can set it globally for all classes in that module
(which can be confusing on its own).

My comment mostly referred to "new-style classes must be declared as a subclass of
a new-style class", which is not true.


Nonsense.

Given the rest of your post, I assume that this isn't meant as it sounds. Remember, I'm
German, so please bear with my sense of humour. ;)

German? Humour? Surely some mistake :-)

not-talking-about-the-war-ly y'rs - steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Aug 31 '05 #11
Steve Holden wrote:
Reinhold Birkenfeld wrote:
Terry Hancock wrote:
On Tuesday 30 August 2005 04:09 pm, Reinhold Birkenfeld wrote:

The customary way is to use "class new_class(objec t):". There's no advantage in using
__metaclass __ except that you can set it globally for all classes in that module
(which can be confusing on its own).

My comment mostly referred to "new-style classes must be declared as a subclass of
a new-style class", which is not true.

Nonsense.

Given the rest of your post, I assume that this isn't meant as it sounds. Remember, I'm
German, so please bear with my sense of humour. ;)

German? Humour? Surely some mistake :-)


Hm, should have added "if any" above...
not-talking-about-the-war-ly y'rs - steve


No surprise it was the Brits who discovered the world's deadliest joke.

Reinhold
Aug 31 '05 #12
On Wednesday 31 August 2005 12:14 pm, Reinhold Birkenfeld wrote:
Steve Holden wrote:
Reinhold Birkenfeld wrote:
>My comment mostly referred to "new-style classes must be declared as a subclass of
>a new-style class", which is not true.

Nonsense.

Given the rest of your post, I assume that this isn't meant as it sounds. Remember, I'm
German, so please bear with my sense of humour. ;)


Yes, it was tongue-in-cheek.

However, there *was* some truth in what I said:

Python *does* indicate implementation details with the
"ignore the man behind the curtain" approach of marking
them with "_" or "__".

Yes, that is the only kind of encapsulation Python really
gives you -- you have to play by the rules if you want
those advantages, and one of the rules is to pretend you
don't see those magic methods.

Except when you really, really need to, of course.

Also, we have to remember that this was a *newbie* question,
so I gave a newbie-approved answer -- I told the "right"
way to do it.

And of course, there is something slightly comical about
this. But you should expect that from a language named
after a comedy troupe, shouldn't you?

The fact that I did this because I didn't know about the
other way is totally unimportant! :-P

You are such a rude man for displaying your intellectual
superiority like that. Fie!

Actually, I was thinking seriously about trying to use the
exact wording of Douglas Adams from "Hitchhiker 's" (approx):
"We have normality, therefore anything you still can't cope
with is your own problem". But it didn't quite fit, and
the other possible reference to the "Son of the Invisible
Man" skit*, was just way too obscure. I doubt you've ever
seen it.

*I think this was in "Amazon Women on the Moon", though it
may have been "Kentucky Fried Movie". Both are TV spoofs.

And, yes, of course, I'm glad you posted about this detail,
I learned something from it, which is why I read this list.

--
Terry Hancock ( hancock at anansispacework s.com )
Anansi Spaceworks http://www.anansispaceworks.com

Aug 31 '05 #13

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

Similar topics

92
6543
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed
125
14855
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
15
2460
by: M.Siler | last post by:
<HTML> <HEAD> <TITLE></TITLE> <SCRIPT> <!-- var factor_val = new Array(8,7) factor_val = 68.8 factor_val = 55
10
2058
by: Steven T. Hatton | last post by:
I read Stroustrup's article of the day: http://www.research.att.com/~bs/C++.html Programming with Exceptions. InformIt.com. April 2001. http://www.research.att.com/~bs/eh_brief.pdf Some of these ideas are finally beginning to sink in. I believe I looked at the same article a while back and decided I wasn't quite ready for it. If I understood things correctly, there seems to be a slight problem with the design of his exception safe...
2
3092
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing this by aggregating new content from all databases into a single indexed database and then saving a timestamp in the account database (for the current user) that tells me when the user last read items in the aggregated database.
26
4497
by: Lasse Edsvik | last post by:
Hello I'm trying to build a simple COM+ app in vs.net using C# and i cant register it in component manager..... what more is needed than this: using System; using System.EnterpriseServices;
9
2824
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am facing. Please please help me to solve this as soon as possible. So here we go ... I am not able to take the screen shot of the windows form based "Smart
21
5232
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each table and 11 sub items with data about each column. When a Row in ListView1 is selected the Data in ListVies2 is loaded to show the correct data. Initially the first row in ListView1 is selected in FormX load
4
1178
by: Hyphessobrycon | last post by:
Private Sub btnrubriekbij_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnrubriekbij.Click 'insert hier Dim cn As New OleDb.OleDbConnection(constr) Dim dc As New OleDb.OleDbCommand dc.Connection = cn
98
4626
by: tjb | last post by:
I often see code like this: /// <summary> /// Removes a node. /// </summary> /// <param name="node">The node to remove.</param> public void RemoveNode(Node node) { <...> }
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9961
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7512
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.