|
by: Roy Smith |
last post by:
I've got a function which gets passed a call-back function as a
parameter. I want to check to make sure the thing passed in is indeed
callable. Is:
assert '__call__' in dir (param)
the right thing to do, or is there something cleaner? Will that work
for all callable values of param, regardless if it's a static function,
class method,...
|
by: Duncan Smith |
last post by:
I recently started to rewrite a class and decided to take a bunch of related
methods and put them in a separate callable class. (They're all what I
would call pointwise operations on pairs of instances, they raise exceptions
for identical reasons, and they all return a new instance). It seemed like
a good idea at the time, but now I'm not so...
|
by: Michal Vitecek |
last post by:
hello everyone,
today i've come upon a strange exception, consider the following file
test.py:
--- beginning of test.py ---
class A(object):
def method1(parA):
print "in A.method1()"
|
by: Mirko Zeibig |
last post by:
Hello everybody,
I recently stumbled across the proposal of removing `callable` in Python
3000 (http://python.org/peps/pep-3000.html) catching an exception
instead, maybe something like this:
--- snip ---
$ python2.3
Python 2.3.3 (#1, Apr 6 2004, 01:47:39)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
|
by: homepricemaps |
last post by:
if i do the following i get the url of an image i am looking for
image = ""
image = bs.img
print image
however if i do this
out.write (image )
i get an error that says "nonetype error is not callable"
|
|
by: Nicolas Fleury |
last post by:
Hi everyone,
I was wondering if it would make sense to make staticmethod objects
callable, so that the following code would work:
class A:
@staticmethod
def foo(): pass
bar = foo()
I understand staticmethod objects don't need to implement __call__ for
|
by: Antoon Pardon |
last post by:
I have been reading http://www.python.org/dev/peps/pep-3100/
en there is written:
To be removed:
...
callable(): just call the object and catch the exception
...
|
by: Ron Garret |
last post by:
If I do this:
def f(self): print self
class c1: pass
setattr(c1, 'm1', f)
Then f is automagically transmogrified into the appropriate sort of
method depending on how it is used:
|
by: Ge Chunyuan |
last post by:
hi Group:
Once use ActivePython latest version for Python 2.5.1.
I happened to find function "str" is not callable, but it is available
for Python 2.5.
Can anybody give some comments about it?
Any response is highly appreciated.
|
by: netimen |
last post by:
Can I substitute a method of a class by a callable object (not a
function)? I can very easy insert my function in a class as a method,
but an object - can't.
I have the following:
class Foo(object):
pass
class Obj(object):
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
|
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. ...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
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...
|
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|