Guido van Rossum wrote:
> Are there real-life uses of stateful adapters that would be thrown out
> by this requirement?
Here are two interfaces we're using in a project:
http://just.letterror.com/ltrwiki/PenProtocol (aka "SegmentPen")
http://just.letterror.com/ltrwiki/PointPen
They're both
Hi Guido,
On Thu, Jan 13, 2005 at 10:20:40PM -0800, Guido van Rossum wrote:
> Hm. Maybe that post points out that adapters that add state are bad,
> period. I have to say that the example of adapting a string to a file
> using StringIO() is questionable. Another possible adaptation from a
> string
On Fri, 14 Jan 2005 08:50:27 +0100, Alex Martelli <[EMAIL PROTECTED]> wrote:
> Ooops -- sorry; I wouldn't have imagined Brazilian hits would swamp the
> google hits to that extent, mostly qualifying post-grad courses and the
> like... seems to be an idiom there for that.
'Lato sensu' is used to in
Brett> The problem I have always had with this proposal is that the
Brett> value is worthless, time tuples do not have a slot for fractional
Brett> seconds. Yes, it could possibly be changed to return a float for
Brett> seconds, but that could possibly break things.
Actually, tim
On 2005 Jan 14, at 10:36, Skip Montanaro wrote:
Brett> The problem I have always had with this proposal is that the
Brett> value is worthless, time tuples do not have a slot for
fractional
Brett> seconds. Yes, it could possibly be changed to return a
float for
Brett> seconds, but
On Fri, 2005-01-14 at 06:40, Alex Martelli wrote:
> +1 -- I never liked the idea that 'time tuples' lost fractions of a
> second. On platforms where that's sensible and not too hard,
> time.time() could also -- unobtrusively and backwards compatibly -- set
> that same attribute. I wonder if,
On Fri, 2005-01-14 at 09:36, Skip Montanaro wrote:
> Actually, time.strptime() returns a struct_time object. Would it be
> possible to extend %S to parse floats then add a microseconds (or whatever)
> field to struct_time objects that is available by attribute only?
+1 for adding a microseconds f
On Thu, Jan 13, 2005 at 08:54:33PM -0500, Raymond Hettinger wrote:
| > Since __conform__ and __adapt__
| > would sprout two new arguments, it would make those writing adapters
| > think a bit more about the kind of adapter that they are providing.
|
| Using optional arguments may not be the most e
On Fri, Jan 14, 2005 at 12:11:10AM -0500, Phillip J. Eby wrote:
| Clark's proposal isn't going to solve this issue for PEP 246, alas. In
| order to guarantee safety of adaptive type declarations, the
| implementation strategy *must* be able to guarantee that 1) adapters do
| not have state of t
Shane Holloway (IEEE) wrote:
For a little background, I'm working on making an edit and continue
support in python a little more robust. So, in replacing references to
unmodifiable types like tuples and bound-methods (instance or class), I
iterate over gc.get_referrers.
So, I'm working on fram
On Fri, Jan 14, 2005 at 09:47:15AM +, Armin Rigo wrote:
| In my opinion a user-defined class or interface mixes two notions: a
| "concept" meaningful for the programmer that the instances
| represent, and the "interface" provided to manipulate it.
...
| This suggests that only concrete objects
At 10:09 AM 1/14/05 +0100, Just van Rossum wrote:
Guido van Rossum wrote:
> Are there real-life uses of stateful adapters that would be thrown out
> by this requirement?
Here are two interfaces we're using in a project:
http://just.letterror.com/ltrwiki/PenProtocol (aka "SegmentPen")
http://jus
At 09:47 AM 1/14/05 +, Armin Rigo wrote:
For example, strings "mean" very
different concepts in various contexts, e.g. a file name, an url, the byte
content a document, or the pickled representation of something.
Note that this is solvable in practice by the author of a method or
framework cho
Phillip J. Eby wrote:
> At 10:09 AM 1/14/05 +0100, Just van Rossum wrote:
> >Guido van Rossum wrote:
> >
> > > Are there real-life uses of stateful adapters that would be
> > > thrown out by this requirement?
> >
> >Here are two interfaces we're using in a project:
> >
> > http://just.letterror.
[Phillip]
> Quick demo (strawman syntax) of declaring adapters...
>
> First, a type declaring that its 'read' method has the semantics of
> 'file.read':
>
> class SomeKindOfStream:
> def read(self, byteCount) like file.read:
> ...
[and more like this]
Sorry, this is de
Hi Phillip,
On Fri, Jan 14, 2005 at 10:22:36AM -0500, Phillip J. Eby wrote:
> Note that this is solvable in practice by the author of a method or
> framework choosing to define an interface that they accept, and then
> pre-defining the adaptation from string to that interface. So, what a
> str
Brett C. wrote:
Other option would be to add a function that either directly modified
single values in f_localsplus, a function that takes a dict and
propogates the values, or a function that just calls
PyFrame_LocalsToFast() .
Brett!! Thanks for looking this up! With a little help from ctypes
FWIW, this should work:
def replaceFrame(self, ref, oldValue, newValue):
for name, value in ref.f_locals.items():
if value is oldValue:
exec "ref.f_locals[name] = newValue"
assert ref.f_locals[name] is newValue
And, no, you don't have to tell
At 08:32 AM 1/14/05 -0800, Guido van Rossum wrote:
I have no desire to add syntax
complexities like this to satisfy some kind of theoretically nice
property.
Whether it's syntax or a decorator, it allows you to create stateless
adapters without needing to write individual adapter *classes*, or eve
At 04:39 PM 1/14/05 +, Armin Rigo wrote:
Ideally, both the caller and the callee know (and write down) that the
function's argument is a "reference to some kind of file stuff", a very
general concept; then they can independently specify which concrete object
they expect and provide, e.g. "a str
On Fri, Jan 14, 2005 at 04:39:00PM +, Armin Rigo wrote:
| I'm trying to reserve the usage of "interface" to something more
| concrete: the concrete ways we have to manipulate a given object
| (typically a set of methods including some unwritten expectations).
I'd say that a programmer inte
On Fri, Jan 14, 2005 at 12:28:16PM -0500, Phillip J. Eby wrote:
| At 08:32 AM 1/14/05 -0800, Guido van Rossum wrote:
| >I have no desire to add syntax
| >complexities like this to satisfy some kind of theoretically nice
| >property.
|
| Whether it's syntax or a decorator, it allows you to create s
Phillip J. Eby wrote:
> For example, if there were a weak reference dictionary mapping
> objects to their (stateful) adapters, then adapt() could always
> return the same adapter instance for a given source object, thus
> guaranteeing a single state.
Wouldn't that tie the lifetime of the adapter
Skip Montanaro wrote:
Brett> The problem I have always had with this proposal is that the
Brett> value is worthless, time tuples do not have a slot for fractional
Brett> seconds. Yes, it could possibly be changed to return a float for
Brett> seconds, but that could possibly break t
On Fri, Jan 14, 2005, Brett C. wrote:
>
> Right, it's a struct_time object; just force of habit to call it a time
> tuple.
>
> And I technically don't see why a fractional second attribute could not be
> added that is not represented in the tuple. But I personally would like to
> see struct_tm
> Date: Fri, 14 Jan 2005 02:38:05 -0500
> From: "Phillip J. Eby" <[EMAIL PROTECTED]>
> Subject: Re: [Python-Dev] PEP 246: lossless and stateless
> To: [EMAIL PROTECTED]
> Cc: "Clark C. Evans" <[EMAIL PROTECTED]>, python-dev@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; ch
>> I realize the %4N notation is distasteful, but without it I think you
>> will have trouble parsing something like
>>
>> 13:02:00.704
>>
>> What would be the format string? %H:%M:%S.%N would be incorrect.
Brett> Why is that incorrect?
Because "704" represents the
On 2005 Jan 14, at 19:11, Aahz wrote:
On Fri, Jan 14, 2005, Brett C. wrote:
Right, it's a struct_time object; just force of habit to call it a
time
tuple.
And I technically don't see why a fractional second attribute could
not be
added that is not represented in the tuple. But I personally woul
On Fri, Jan 14, 2005, Alex Martelli wrote:
> On 2005 Jan 14, at 19:11, Aahz wrote:
>>On Fri, Jan 14, 2005, Brett C. wrote:
>>>
>>>Right, it's a struct_time object; just force of habit to call it a
>>>time tuple.
>>>
>>>And I technically don't see why a fractional second attribute could
>>>not be ad
On Fri, Jan 14, 2005 at 10:02:39AM -0800, Michel Pelletier wrote:
| Phillip J. Eby wrote:
| > The result is that you generate a simple adapter class whose
| > only state is a read-only slot pointing to the adapted object,
| > and descriptors that bind the registered implementations to that object.
On 2005 Jan 14, at 20:25, Clark C. Evans wrote:
| Does anyone know of any other languages that take this "operational"
| aproach to solving the substitutability problem?
Microsoft's COM?
I don't see the parallel: COM (QueryInterface) is strictly
by-interface, not by-method, and has many other diff
At 06:56 PM 1/14/05 +0100, Just van Rossum wrote:
Phillip J. Eby wrote:
> For example, if there were a weak reference dictionary mapping
> objects to their (stateful) adapters, then adapt() could always
> return the same adapter instance for a given source object, thus
> guaranteeing a single state
At 12:41 PM 1/14/05 -0500, Clark C. Evans wrote:
May I suggest that you write this up as a PEP?
Already committed to it for this weekend, but my statement was buried in a
deep thread between Alex and I, so you might've missed it.
___
Python-Dev mailing
At 10:02 AM 1/14/05 -0800, Michel Pelletier wrote:
I get it!
Thanks for the positive feedback, I was getting worried that I had perhaps
gone quite insane during the great debate. :)
Your last description didn't quite sink in but this one does and
I've been thinking about this quite a bit, and
At 02:25 PM 1/14/05 -0500, Clark C. Evans wrote:
I'm not sure what else this mechanism provides; besides limiting
adapters so that they cannot maintain their own state.
* No need to write adapter classes for stateless adapters; just declare
methods
* Allows partial adapters to be written for e.g.
Skip Montanaro wrote:
>> I realize the %4N notation is distasteful, but without it I think you
>> will have trouble parsing something like
>>
>> 13:02:00.704
>>
>> What would be the format string? %H:%M:%S.%N would be incorrect.
Brett> Why is that incorrect?
Because
On Fri, 2005-01-14 at 10:07 -0500, Phillip J. Eby wrote:
> Maybe I'm missing something, but for those interfaces, isn't it okay to
> keep the state in the *adapted* object here? In other words, if PointPen
> just added some private attributes to store the extra data?
I have been following thi
On Jan 14, 2005, at 19:02, Glyph Lefkowitz wrote:
On Fri, 2005-01-14 at 10:07 -0500, Phillip J. Eby wrote:
Maybe I'm missing something, but for those interfaces, isn't it okay
to
keep the state in the *adapted* object here? In other words, if
PointPen
just added some private attributes to store
On Fri, 14 Jan 2005 19:02:52 -0500, Glyph Lefkowitz <[EMAIL PROTECTED]> wrote:
> On Fri, 2005-01-14 at 10:07 -0500, Phillip J. Eby wrote:
>
> > Maybe I'm missing something, but for those interfaces, isn't it okay to
> > keep the state in the *adapted* object here? In other words, if PointPen
> > j
At 05:37 PM 1/14/05 -0700, Steven Bethard wrote:
On Fri, 14 Jan 2005 19:02:52 -0500, Glyph Lefkowitz <[EMAIL PROTECTED]> wrote:
> On Fri, 2005-01-14 at 10:07 -0500, Phillip J. Eby wrote:
>
> > Maybe I'm missing something, but for those interfaces, isn't it okay to
> > keep the state in the *adapted
At 07:02 PM 1/14/05 -0500, Glyph Lefkowitz wrote:
For the sake of argument, let's say that SegmentPen is a C type, which
does not have a __dict__, and that PointPen is a Python adapter for it,
in a different project.
There are multiple implementation alternatives possible here; it isn't
necessary
Shane Holloway (IEEE) wrote:
Yes. After poking around in Google with PyFrame_LocalsToFast, I found
some other links to people doing that. I implemented a direct call
using ctypes to make the code explicit about what's happening. I'm just
glad it is possible now. Works fine in both 2.3 and 2.
On Fri, 2005-01-14 at 19:14 -0500, Bob Ippolito wrote:
> I think the idea is that it's "better" to have an adapter from
> IBusinessThunk -> IGtkUIPlugFactory, which you can use to *create* a
> stateful object that complies with the IGtkUIPlug interface.
>
> This way, you are explicitly creating
43 matches
Mail list logo