qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rafael Schloming <rafa...@redhat.com>
Subject Re: C++, Python: Common Includes
Date Wed, 11 Feb 2009 17:25:06 GMT
Jonathan Robie wrote:
>  From our sample programs:
> 
> C++:
> 
> #include <qpid/client/Connection.h>
> #include <qpid/client/Session.h>
> using namespace qpid::client;
> using namespace qpid::framing;
> 
> Python:
> 
> import qpid
> import sys
> import os
> from qpid.util import connect
> from qpid.connection import Connection
> from qpid.datatypes import Message, RangedSet, uuid4
> from qpid.queue import Empty
> 
> To me, the C++ is clean and easy to remember. To me, the Python is 
> cluttered, and I have to look it up each time. In general, if I import a 
> class, I don't want to have to ask "what else do I need to import if I 
> want to be able to use the class I just imported?"
> 
> In Python, couldn't the user just import a Connection class and a 
> Session class, and we could design the API so that they get what they 
> need to use those classes automagically?  Or is there a pythonic reason 
> to do it this way?

This isn't really an apples to apples comparison. You can do * imports 
in python as well, it's just considered better style to actually list 
out what you're importing:

from qpid.connection import *
from qpid.datatypes import *
from qpid.util import *
from qpid.queue import *

--Rafael




---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


Mime
View raw message