473,396 Members | 2,057 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.

Re: Wouldn't it be nice if this worked?

On Mon, 11 Aug 2008 00:47:14 +0530, "Suresh V." <su*******@yahoo.comwrote:
>class A:
def add(self, x, y):
return x+y

class B:
pass

B.add = A.add

print B().add(1, 2) <----- gives TypeError: unbound method add() must
be called with A instance as first argument
Why?
Aug 10 '08 #1
0 1190

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

Similar topics

43
by: Dan Perl | last post by:
Here is a python feature that I would like: to be able to import modules from an archive like the jar files in Java. Maybe a regular tar file? Maybe a python specific file type, let's call it a...
24
by: Bob Alston | last post by:
Could develop web pages that would interact with the access/jet database - like DAP but without the security flaw??? One of Access' competitors (Filemaker Pro as I recall) touts its EASY way to...
4
by: robert d via AccessMonster.com | last post by:
When my app starts up, it creates a temporary database. This temp database is created from a 'model' database that is in the same folder as the application. Because there is a model, the creation...
5
by: stdazi | last post by:
Hello, Yesterday, I was at a programming competition. We programmed on Linux liveCD's and Python was one of the allowed languages (among C and Java). I cared just about the algorithmic approach...
4
by: =?Utf-8?B?Z3V5?= | last post by:
If all WebForms controls were prefixed 'web' and all WinForms controls were prefixed ''win' (and were otherwise named the same?) guy
3
by: WebCM | last post by:
How to apply nice URL-s into CMS? 1. Should we use nice urls for every page? 2. Do we need to put a FULL path into <a href="">? 3. What is faster and better? a) 10 rules in .htaccess...
0
by: Patrick Mullen | last post by:
How about: class A: def add(self,x,y): return x+y class B(A): pass print B().add(1, 2)
2
by: Miki | last post by:
Hello All, Can anybody explain why Makefile $(PWD) does show the right directory when running under subprocess.Popen(..., cwd=...) For example: tmp $cat /tmp/p/Makefile all: @echo $(PWD) ...
6
by: Chris Becke | last post by:
I *know* my CPU has opcodes that can do this - when adding (or subtracting) there is a carry flag that can be invoked to make the result essentially 1 bit longer than the data size used in...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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,...

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.