MS Windows Clipboard

Alex Martelli aleaxit at yahoo.com
Fri Oct 27 07:23:17 EDT 2000


"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:kU2K5.900$Tq6.8387 at news-server.bigpond.net.au...
    [snip]
> > > What would this param look like - maybe a simple string
> > > "string", "unicode", "handle", with None or "" == default?
>
> Alex suggested a type object:
> > Or maybe type(""), type(u""), type(PyHandle)...?
>
> Your idea sounds more "correct", but also more verbose and less
> "handy"
>
> OTOH, using the types module makes it better:
>
>   GetClipboardText(..., types.UnicodeType)

Is types.UnicodeType "less verbose and handier" than type(u'')...?!
I count 8 more characters plus the need to import types.

Anyway, that stylistic choice is up to client-code, if you use the
type object as the discriminator of what type of result is desired
in the GetClipboardData function you expose; calling it with either
expression will pass it the same object and get the same result.


>   GetClipboardText(..., types.UnicodeType)
> or
>   GetClipboardText(..., "unicode")

GetClipboardData is more what I had in mind, although a
utility function called GetClipboardText could, I guess,
surely also be introduced (it's not currently in the
module win32clipboard -- or, at least, not in its docs),
for symmetry with the Set functions (which do exist in
both flavours -- convenient ...Text, general ...Data).


Alex






More information about the Python-list mailing list