Tres Seaver wrote:
We were discussion a (notional) value adapter, whose factory would
have the contract of returning an object of a specific concrete type,
rather than on implementing an interface.
Right, but the CA supports the use of classes instead of interfaces and
that works just fine
Dieter Maurer wrote:
As Chris example demonstrates, it would have been better
to call IZopeDublinCore(myobj) the IZopeDublinCore
adaptation of myobj.
Agreed, and would have saved me a lot of confusion.
cheers,
Chris
--
Simplistix - Content Management, Zope Python Consulting
-
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chris Withers wrote:
Tres Seaver wrote:
We were discussion a (notional) value adapter, whose factory would
have the contract of returning an object of a specific concrete type,
rather than on implementing an interface.
Right, but the CA
Philipp von Weitershausen wrote:
Not sure what official terminology glossary you're basing this on, but
we often refer to IZopeDublinCore(myobj) as the IZopeDublinCore
adapter of myobj. Whatever is called to instantiate that object we
call the adapter factory or adapter implementation. The
Philipp von Weitershausen wrote:
IZopeDublinCore(obj)
is a flexible version of
ZDCAnnotatableAdapter(obj)
Flexible, because a different implementation that ZDCAnnotatableAdapter
might be used. That's dispatched through the adapter registry.
Right, exactly.
IZopeDublinCore(myobj)
Jean-Marc Orliaguet wrote:
once you have that utility / adapter you should be able to call it like:
converter = getAdapterFor(123, type=IToStringConverter)
strResult = converter.convert(123)
Not quite, what I'm looking to do is more along the lines of:
mystr = getAdapter(123,str)
(where
Chris Withers wrote:
Philipp von Weitershausen wrote:
Not sure what official terminology glossary you're basing this on,
but we often refer to IZopeDublinCore(myobj) as the IZopeDublinCore
adapter of myobj. Whatever is called to instantiate that object we
call the adapter factory or adapter
Philipp von Weitershausen wrote at 2006-11-15 21:11 +0100:
...
Not sure what official terminology glossary you're basing this on
I am basing this on the meaning of english words.
An adapter is something that adapts (and not something that is adapted).
adapt is a transitive verb. It applies to
Jean-Marc Orliaguet wrote at 2006-11-15 20:51 +0100:
...
but what problem is all this supposed to solve? are you guys writing a
PhD or something .-) ?
Well chosen terminology is a key to understanding.
Therefore, it is justified to discuss about it.
--
Dieter
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Chris Withers wrote:
Philipp von Weitershausen wrote:
IZopeDublinCore(obj)
is a flexible version of
ZDCAnnotatableAdapter(obj)
Flexible, because a different implementation that ZDCAnnotatableAdapter
might be used. That's dispatched
Philipp von Weitershausen wrote:
...hence the quotes. It's a function in that I want to use it as an
adapter that doesn't need to be instantiated by a factory before being
used.
All adapters need to be instantiated.
Why?
def myStrAdapter(something):
return str(something)
This
Chris Withers wrote:
Philipp von Weitershausen wrote:
...hence the quotes. It's a function in that I want to use it as an
adapter that doesn't need to be instantiated by a factory before being
used.
All adapters need to be instantiated.
Why?
def myStrAdapter(something):
Chris Withers wrote:
Philipp von Weitershausen wrote:
...hence the quotes. It's a function in that I want to use it as an
adapter that doesn't need to be instantiated by a factory before
being used.
All adapters need to be instantiated.
Why?
def myStrAdapter(something):
return
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100:
...
def myStrAdapter(something):
return str(something)
It instantiates a 'str' object. The 'str' object is the adapter for
'something'.
Huh? This would be a severe terminology abuse:
An adapter should adapt something to
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100:
...
def myStrAdapter(something):
return str(something)
It instantiates a 'str' object. The 'str' object is the adapter for
'something'.
Huh? This would be a severe terminology abuse:
I agree, it's bending
Philipp von Weitershausen wrote at 2006-11-15 20:34 +0100:
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100:
...
def myStrAdapter(something):
return str(something)
It instantiates a 'str' object. The 'str' object is the adapter for
'something'.
Huh? This
Philipp von Weitershausen wrote:
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100:
...
def myStrAdapter(something):
return str(something)
It instantiates a 'str' object. The 'str' object is the adapter for
'something'.
Huh? This would be a severe
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 20:34 +0100:
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100:
...
def myStrAdapter(something):
return str(something)
It instantiates a 'str' object. The 'str' object is the adapter for
Philipp von Weitershausen wrote:
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 20:34 +0100:
Dieter Maurer wrote:
Philipp von Weitershausen wrote at 2006-11-15 15:08 +0100:
...
def myStrAdapter(something):
return str(something)
It instantiates a 'str' object. The
Jean-Marc Orliaguet wrote:
str(123) has the same syntax as IZopeDublinCore(myobj), but semantically
there is nothing in common between the two expressions.
I disagree.
IZopeDublinCore(obj)
is a flexible version of
ZDCAnnotatableAdapter(obj)
Flexible, because a different
Philipp von Weitershausen wrote:
Chris Withers wrote:
Christian Theune wrote:
The problem you have is to provide a specification for the 'str'
interface.
There are a couple of problems here...
1. str is both a function and a class
Nope. It's a class since Python 2.2.
...hence the
Tres Seaver wrote:
Heh, in this case using 'IString' is really a trussed duck (duck
typing with BD) ;) Python's duck typing breaks down with strings,
because they can by quack tested like sequences, but you almost
*never* want to treat them the same way as other sequences, so you end
up with
whit wrote:
hello RuleDispatch...
What's RuleDispatch?
Chris
--
Simplistix - Content Management, Zope Python Consulting
- http://www.simplistix.co.uk
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub:
Chris Withers wrote:
Philipp von Weitershausen wrote:
Chris Withers wrote:
Christian Theune wrote:
The problem you have is to provide a specification for the 'str'
interface.
There are a couple of problems here...
1. str is both a function and a class
Nope. It's a class since Python 2.2.
Christian Theune wrote:
The problem you have is to provide a specification for the 'str' interface.
There are a couple of problems here...
1. str is both a function and a class
2. I was to register the function str as an adapter for, say, the
class int to the class str, so there's not
Chris Withers wrote:
Christian Theune wrote:
The problem you have is to provide a specification for the 'str'
interface.
There are a couple of problems here...
1. str is both a function and a class
Nope. It's a class since Python 2.2.
2. I was to register the function str as an adapter
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Philipp von Weitershausen wrote:
Chris Withers wrote:
Christian Theune wrote:
The problem you have is to provide a specification for the 'str'
interface.
There are a couple of problems here...
1. str is both a function and a class
Nope.
Tres Seaver wrote:
Philipp von Weitershausen wrote:
Chris Withers wrote:
Christian Theune wrote:
The problem you have is to provide a specification for the 'str'
interface.
There are a couple of problems here...
1. str is both a function and a class
Nope. It's a class since Python 2.2.
2.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Philipp von Weitershausen wrote:
Tres Seaver wrote:
snip
Thnk of cataloguing / indexing use cases: adapting the catalogued
object to a string value (or tuple, or whatever) using named adapters is
a very natural way to make indexing pluggable:
Tres Seaver wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Philipp von Weitershausen wrote:
Tres Seaver wrote:
snip
Thnk of cataloguing / indexing use cases: adapting the catalogued
object to a string value (or tuple, or whatever) using named adapters is
a very natural way to make
On Fri, 2006-10-11 at 08:00 +, Chris Withers wrote:
This is a toy example, but I need to do something similar and can't seem
to get the registration right...
How can I register the str builtin as an adapter from python int objects
to python str objects?
I've personally found when I
31 matches
Mail list logo