Performance of Blocks in Python

2006-05-09 Thread Dilip

I read a couple of interesting blog posts about the performance of
blocks in languages like Ruby, Python here[1] and here[2].  The posts
start out questioning Ruby but towards the middle and the end it does
draw analogies between python's design decision to introduce 'with'
statement as a language extension rather than a closure.

[1] http://pluralsight.com/blogs/dbox/archive/2006/05/09/23068.aspx
[2] http://pluralsight.com/blogs/dbox/archive/2006/05/08/23001.aspx

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Cpp + Python: static data dynamic initialization in *nix shared lib?

2010-07-13 Thread Dilip
On Jul 13, 2:34 am, "Alf P. Steinbach /Usenet"  wrote:
> Well, we got no further, but I know of three solutions:
>
>    A) Punting: just say that the compiler has to support C++/C function type
>       mingling.
>       -> Perhaps the practical solution, but formally unsafe.
>
>    B) On the script side of things, delegate all calls to single Mother Of All
>       C func downcaller that supplies as extra arg an id of the C++ function.
>       -> Micro-level inefficient but easy to use and formally correct.
>
>    C) Let the user define the C linkage function wrappers via macros.
>       -> Efficient and formally correct but exposes ugly macro names.
>
> I chose (C).

Alf

This may or may not be what you are looking for but the middleware Ice
provides language mapping to enable Python to call into the Ice
libraries which are basically written in C++.  You can take a look at
this: http://www.zeroc.com/icepy.html

However that page may not be very descriptive.  The codebase, though,
is freely downloadable.  You can take a look at it if that will help
although you need to wade around a little bit to figure out what is
where.
-- 
http://mail.python.org/mailman/listinfo/python-list


File Reading In Mac

2010-11-22 Thread dilip raghavan
Hello ,
 I have been trying to read contents from a file in MAC.
I wrote the code

filename = "test.rtf"
FileHandle = open(filename,'r')

fileStr = FileHandle.read()
print fileStr
FileHandle.close()

When I see the output I see a lot of junk. The junk is like a lot of
question marks, the font information and other details of the file.
The actual content is lost in the junk.

I have tried other methods like readline but still I see the junk.
I tried the asme code in windows and it worked correctly.
Can any one tell me the reason and the solution  for this.

Thanks In advance.
-- 
http://mail.python.org/mailman/listinfo/python-list