Adam DePrince wrote:
> Question #2:
>
> What should delete() return? I currently have it returning the iter
> itself to make it possible to say:
>
> value = iter.delete().next()
Python doesn't generally return self for call-chaining purposes. I'd
say delete()
intend to bore people with a study of adaptation in Zope 3, but
instead am attempting to echo Alex's realization that once you have the
simple tools of adaptation in mind (much like other practices like OO or
data-driven programming) you start to recognize places where they help
you solve probl
) method to mpz objects and flagged them as providing
IIndex, my adapter wouldn't be necessary any more (because adapting
something to an interface that it already provides returns the original
object). Alternately they could provide their own adapter, and I could
stop using mine.
--
Benji
ice for "bare" dict iteration.
--
Benji York
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
e it creates benefits.
> So I have to think
> ahead and try to anticipate what adaptations
> other people might want my code to make.
Just as you have to think ahead and anticipate what functionality other
people might want. Adaptation isn't magic; it's still part of iter
Greg Ewing wrote:
> Benji York wrote:
>>If I, as the user of the interface, have something I want to
>>pass in that doesn't match I it to the appropriate interface the burden
>>is on me to create something that matches expectations. People do that
>>all the
IMpz)
@interface.implementer(IIndex)
def index(mpz):
return long(mpz)
The zope.component README goes into more detail (especially the
"Adapters" section):
http://svn.zope.org/*checkout*/Zope3/trunk/src/zope/component/README.txt?rev=39671
--
Benji York
___
approach and defining a very narrow set of requirements
to make a module reloadable. Perhaps something along those lines would
be useful for Py3K.
--
Benji York
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/list
next best thing I can come up with is:
def f(a, b, =, c, d):
The "=" vaguely references the "=" in keyword arguments.
--
Benji York
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-
Antoine Pitrou wrote:
> Why not:
> def f(a, b, !c, !d):
>
> The exclamation mark can be thought to say "you must explicitly mention
> this one by its name".
> I think having a sigil in front of a variable name is less ugly than
> having a separate sigil between commas as a fake parameter.
In th
Antoine Pitrou wrote:
> Le mercredi 24 mai 2006 à 17:15 -0400, Benji York a écrit :
>
>>In that case, just use the current default value syntax, sans value (d,
>>below):
>>
>>def f(a, b, c=None, d=):
>
> Then we can't decide whether "c" can be
ys; read, write, etc.).
These (especially the marker interfaces) don't seem to be statements
about what the objects can do (abilities), but about other
characteristics, therefore a more general name like "interface" seems
appropriate.
--
Benji York
send you copies
of messages you were sent directly via the "Avoid duplicate copies of
messages?" option.
--
Benji York
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://ma
perhaps there should be an ABC that
things like lists and tuples provide, but strings don't. No idea what
that might be.
--
Benji York
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
Greg Ewing wrote:
> Barry Warsaw wrote:
>
>> We already have an established, community accepted implementation of
>> interfaces,
>
> Really? Which one is that?
I believe Barry was referring to zope.interface.
--
Benji Y
) with a generic function individuals could add implementations
for that return True?
--
Benji York
http://benjiyork.com
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.py
argument (from many corners) now that it seems ABCs are destined to
appear in 3.0.
If 3.0 /is/ going to give the "typecheck" ability to basic types, then
the argument is: should it be ABCs, interfaces, generic functions, or
something else.
--
Benji York
http://benjiyork.com
___
^
> SyntaxError: EOL while scanning single-quoted string
> In the first case, it's treated as a continuation character even though
> it's not at the end of a physical line. So it gives an error.
No, that is unrelated to line continuation. The \" is an escap
rification is done).
My point is, people generally use zope.interface Interfaces as
documentation and names for particular behavior/API, not as an LBYL
enforcement mechanism.
--
Benji York
http://benjiyork.com
___
Python-3000 mailing list
Python-3000@python.
Phillip J. Eby wrote:
> At 06:11 PM 5/9/2007 -0400, Benji York wrote:
>> By way of clarification: Even in the large Zope 3 projects I work on
>> (which obviously use zope.interface), we virtually never use
>> interfaces for LBYL (just as Zope 3 itself rarely does).
>
ng a string
> import, before I got there.
zope.interface also allows "lazy" imports using string versions of
module names in specific circumstances where circular dependencies are
common.
--
Benji York
http://benjiyork.com
___
Python-3000 m
Eric V. Smith wrote:
> Benji York wrote:
>> zope.interface also allows "lazy" imports using string versions of
>> module names in specific circumstances where circular dependencies are
>> common.
>
> Could you give an example of that? I'm familiar
import verifyObject
>>> verifyObject(Guard, our_robot)
True
> Concrete methods are required to match exactly the signature demanded
> by the role. Here, we've attempted to fulfill our role by defining a
> concrete version of ``bark()``, but we've miss
Guido van Rossum wrote:
> On 5/14/07, Benji York <[EMAIL PROTECTED]> wrote:
>> Collin Winter wrote:
>>> PEP: 3133
>>> Title: Introducing Roles
>> Everything included here is included in zope.interface. See in-line
>> comments below for the analogs.
>
Guido van Rossum wrote:
> On 5/16/07, Benji York <[EMAIL PROTECTED]> wrote:
>> Guido van Rossum wrote:
>>> On 5/14/07, Benji York <[EMAIL PROTECTED]> wrote:
>>>> Collin Winter wrote:
>>>>> PEP: 3133
>>>>> Title: Introducing Ro
Joachim König wrote:
> could someone enlighten me why
>
> {,}
>
> can't be used for the empty set, analogous to the empty tuple (,)?
Partially because (,) is not the empty tuple, () is.
--
Benji York
http://benjiyork.com
___
Pyth
is from the current
>> location.
>
> Presumably this would go along with introducing a new "wink" method.
> I wonder what it would do. (Close the file briefly?)
That's a great idea! It can be called in response to a HUP to rotate
log files.
me.wink()-ly y'r
quite a bit nicer.
If you write your "whole file" doctests in ReST, you can also render
them to HTML as is done for the packages we put in pypi (here's a short
example: http://cheeseshop.python.org/pypi/zc.queue/1.1, ReST source at
http://svn.zope.or
Alexandre Vassalotti wrote:
> I expect other tools, like pdb.py and trace.py could follow this
> convention as well. For example:
I used the time machine to convince the author of trace.py use this
convention.
He didn't like your spelling, but eventually agreed to #pragma NO COVER
ill really do that, but
at least the irony would be worth it.
--
Benji York
http://benjiyork.com
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/o
n pickle itself?
I believe he's talking about a situation where pickle calls back into
Python.
--
Benji York
http://benjiyork.com
___
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
it with a
> capital 'V'? ;)
>
> On the one hand, I really like consistency in my programming languages.
> On the other hand, a foolish consistency is the hobgoblin of little minds.
I call quote misapplication. Having predictable identifier names isn't
"
32 matches
Mail list logo