On 18/08/2012 02:44, Steven D'Aprano wrote:
Makes you think that Google is interested in fixing the bugs in their
crappy web apps? They have become as arrogant and as obnoxious as
Microsoft used to be.
Charging off topic again, but I borrowed a book from the local library a
couple of months
On Fri, 17 Aug 2012 04:50:43 -0700, Richard Thomas wrote:
> On Thursday, 16 August 2012 19:49:43 UTC+2, Steven D'Aprano wrote:
>> On Thu, 16 Aug 2012 10:03:51 -0700, Richard Thomas wrote:
>>
>> > class Foo(object):
>> > def __new__(cls, arg):
>> > if isinstance(arg, list):
>> >
On Thursday, 16 August 2012 19:49:43 UTC+2, Steven D'Aprano wrote:
> On Thu, 16 Aug 2012 10:03:51 -0700, Richard Thomas wrote:
>
>
>
> > class Foo(object):
>
> > def __new__(cls, arg):
>
> > if isinstance(arg, list):
>
> > cls = FooList
>
> > elif isinstance(
On Thu, 16 Aug 2012 19:18:18 +0200, Thomas Bach wrote:
> Imagine you have two data sets:
>
> d1 = {'foo': None}
> d2 = {'foo': 8}
>
> Where I would assume that d1 has "foo" not set. That's why I want this
> whole "merge"-thing in the first place: to be able to extract the type
> {'foo': None} fr
On Thu, 16 Aug 2012 14:52:30 +0200, Thomas Bach wrote:
> I'm
> querying the crunchbase API which returns JSON data and is rather poorly
> documented. I want to create a data model for the companies listed on
> Crunchbase in order to be able to put the queried data in a data-base.
> As I am too laz
On Thu, 16 Aug 2012 10:03:51 -0700, Richard Thomas wrote:
> class Foo(object):
> def __new__(cls, arg):
> if isinstance(arg, list):
> cls = FooList
> elif isinstance(arg, dict):
> cls = FooDict
> return object.__new__(cls, arg)
>
> class FooList
On Thu, 16 Aug 2012 10:09:08 -0700, Richard Thomas wrote:
>> a is a Foo
>> b is a Foo
>> therefore a and b are the same type
>
> What you mean here is "a and b share a common base class".
No. I mean what I said: since a and b are both direct instances of Foo,
not subclasses, they are both the s
On Thu, Aug 16, 2012 at 10:03:51AM -0700, Richard Thomas wrote:
> class Foo(object):
> def __new__(cls, arg):
> if isinstance(arg, list):
> cls = FooList
> elif isinstance(arg, dict):
> cls = FooDict
> return object.__new__(cls, arg)
>
> class Fo
On Thu, Aug 16, 2012 at 12:29:21PM -0400, Dennis Lee Bieber wrote:
> On Thu, 16 Aug 2012 14:52:30 +0200, Thomas Bach
> declaimed the following in
> gmane.comp.python.general:
>
> Of course, since the parse result (at least from my recent
> experiment) is a Python structure, it isn't difficu
> a is a Foo
> b is a Foo
> therefore a and b are the same type
What you mean here is "a and b share a common base class".
--
http://mail.python.org/mailman/listinfo/python-list
class Foo(object):
def __new__(cls, arg):
if isinstance(arg, list):
cls = FooList
elif isinstance(arg, dict):
cls = FooDict
return object.__new__(cls, arg)
class FooList(Foo, list):
pass
class FooDict(Foo, dict):
pass
You could even hav
On Thu, Aug 16, 2012 at 05:10:43PM +0200, Hans Mulder wrote:
> On 16/08/12 14:52:30, Thomas Bach wrote:
> >
> > So, my question (as far as I can see it, please correct me if I am
> > wrong) is less of the "How do I achieve this?"-kind, but more of the
> > "What is a clean design for this?"-kind. M
On 16/08/12 14:52:30, Thomas Bach wrote:
> On Thu, Aug 16, 2012 at 12:16:03AM +, Steven D'Aprano wrote:
>> > Some comments:
>> >
>> > 1) What you show are not "use cases", but "examples". A use-case is a
>> > description of an actual real-world problem that needs to be solved. A
>> > couple
On Thu, Aug 16, 2012 at 12:16:03AM +, Steven D'Aprano wrote:
> Some comments:
>
> 1) What you show are not "use cases", but "examples". A use-case is a
> description of an actual real-world problem that needs to be solved. A
> couple of asserts is not a use-case.
Thanks for the clarificatio
On Wed, 15 Aug 2012 23:17:41 +0200, Thomas Bach wrote:
> Hi list,
>
> I'm confronted with a strang problem I cannot find a clean solution for.
> I want a class that determines on instantiating its base classes
> dynamically. Consider the following two use cases
Some comments:
1) What you show a
On 15/08/2012 22:17, Thomas Bach wrote:
Hi list,
I'm confronted with a strang problem I cannot find a clean solution
for. To me it seems like I need meta-classes. Anyway, I stucked a bit
deeper in that topic and couldn't find a proper solution neither. But,
judge for yourselve.
I want a class t
Hi list,
I'm confronted with a strang problem I cannot find a clean solution
for. To me it seems like I need meta-classes. Anyway, I stucked a bit
deeper in that topic and couldn't find a proper solution neither. But,
judge for yourselve.
I want a class that determines on instantiating its base c
17 matches
Mail list logo