Hi,
I am wrapping a C function returning large amount of binary data back to
Python using SWIG.
I have the data malloc()ed or new()ed on the heap and buffer objects seem a
good way to wrap it in python
(http://docs.python.org/api/bufferObjects.html)
From the documentation it seems
Saturday 13 August 2005 06:18 am Donn Cave wrote:
Of course, but the question was, where do reads start? I would
guess the GNU C library innovated on this point. But in the
end it doesn't really matter unless Python is going to try to
square that all up and make open() consistent across
posted mailed
Hi,
AFAICT there seems to be a bug on FreeBSD's Python 2.3.4 open function. The
documentation states:
Modes 'r+', 'w+' and 'a+' open the file for updating (note that 'w+'
truncates the file). Append 'b' to the mode to open the file in binary
mode, on systems that differentiate
Friday 12 August 2005 22:12 pm paolino wrote:
[...]
f = open('test', 'a+')
f.read()
''
- append mode does not read from file, *not ok*
This is right IMO 'a' is appending so seek(-1)
True, thank you.
f.tell() shows the file pointer is at EOF. On my Debian Linux (unstable),
Python 2.3.4
Friday 12 August 2005 22:12 pm David Bolen wrote:
Which version of FreeBSD are you running? I thought it might be a
dependency on needing to seek between reads and writes on a duplex
stream (which is ANSI), but FreeBSD doesn't require that, at least
back as far as a 4.7 system I have, and I
Hi,
I have come across the following statement a number of times:
http://mail.python.org/pipermail/python-list/2003-July/171805.html
[... how to enforce pure abstract class ...]
Python, in general, doesn't try to stop the programmer doing things, the
way many other languages do. This is known
Hi,
I have a diamond-shaped multiple inheritanc chain with new style classes,
but super() does not call the parent class correctly:
-- snip --
from qtcanvas import *
class B2(QCanvasItem):
def move(self, x,y):
super(B2, self).move(0,0)
print B2
class C2(QCanvasItem):
Friday 24 June 2005 09:18 am Enrico wrote:
[...]
--This code will, because the first two dashes make the rest a comment,
breaking the block
---[[
print(10)
--]]
[...]
python:
print 10
and
#
print 10
#
C++:
/*
print(10);
*/
and
///*
print(10);
//*/
?
I
Hi,
I have a subclassed PyQt class:
class Node(object):
def move(self, x,y): pass
class CRhomb(QCanvasPolygon, Node): pass
$ python
v2.4.1
CRhomb.mro()
[class '__main__.CRhomb', class 'qtcanvas.QCanvasPolygon', class
'qtcanvas.QCanvasPolygonalItem', class 'qtcanvas.QCanvasItem',
Thursday 23 June 2005 19:22 pm Terry Reedy wrote:
[...]
In the absence of other information, I would presume that none of the
other classes have a move() method.
move() is implemented in the class qtcanvas.QCanvasItem
I checked the pyqt sources and it is linked via sip to the C++ object file.
Hi,
I use the GNU autotools for packaging my python applications. My problem is
that as I have both python2.3 and python2.4 installed the automake macros
always detects the newest version and sets it path variables accordingly.
How can I package the program for different versions of Python?
Friday 29 April 2005 05:40 am Michele Simionato wrote:
Uwe Mayer:
Why does the print statement return a syntax error here?
Google for Python regrets where Guido admits that
'print' should have been a function.
:) Will this change in future - and if not, why not?
Ciao
Uwe
--
http
Is it possible to specify anonymous functions, something like:
f = {print hello world}
f()
hello world
in Pyton?
Lambda expressions don't work here.
Thanks,
Uwe
--
http://mail.python.org/mailman/listinfo/python-list
Friday 29 April 2005 00:06 am Paul Rubin wrote:
Closest you can come is:
f = lambda: sys.stdout.write(hello world\n)
Ah. :))
Why does the print statement return a syntax error here?
lambda: print(hallo)
File stdin, line 1
lambda: print(hallo)
^
SyntaxError: invalid
Hi,
I've got a ISO 8601 formatted date-time string which I need to read into a
datetime object.
Is there a shorter way than using regular expressions? Is there a sscanf
function as in C?
Thanks,
Uwe
--
http://mail.python.org/mailman/listinfo/python-list
Tuesday 12 April 2005 06:36 am Steven Bethard wrote:
Uwe Mayer wrote:
I've been looking into ways of creating singleton objects.
It strikes me that I've never wanted or needed a singleton object.
Would you mind sharing your use case? I'm just curious.
I am using a class to manage
Tuesday 12 April 2005 10:01 am Steven Bethard wrote:
I am using a class to manage configuration settings in an application.
This object should only existe once so that when the user
changes a setting through a configuration dialog the change imminent in
all locations where access to config
Tuesday 12 April 2005 12:09 pm Michele Simionato wrote:
Steven Bethard:
It strikes me that I've never wanted or needed a singleton object.
Would you mind sharing your use case? I'm just curious.
Singleton is the most idiotic pattern ever. If you want an instance,
just
instantiate your
Tuesday 12 April 2005 14:51 pm Michele Simionato wrote:
No. Not everybody knows about Singleton. It is an acquired knowledge.
Well, what isn't?
What I ment to say, but failed to do so more explicitly, was that it is a
term I felt which was generally known to the programming society. Or that
it
Tuesday 12 April 2005 17:00 pm Michele Simionato wrote:
I did not put memoize on __new__. I put it on the metaclass __call__.
Here is my memoize:
[...]
Clever, thanks! :)
Ciao
Uwe
--
http://mail.python.org/mailman/listinfo/python-list
Tuesday 12 April 2005 17:00 pm Michele Simionato wrote:
I did not put memoize on __new__. I put it on the metaclass __call__.
Here is my memoize:
def memoize(func):
memoize_dic = {}
def wrapped_func(*args):
if args in memoize_dic:
return memoize_dic[args]
Tuesday 12 April 2005 18:51 pm Michele Simionato wrote:
Uhm? If I pass different parameters I want to have
different instances. The Singleton behaviour is recovered
only when I pass always the same arguments, in
particular when I pass 0-arguments:
class Foobar:
... __metaclass__ =
Hi,
I've been looking into ways of creating singleton objects. With Python2.3 I
usually used a module-level variable and a factory function to implement
singleton objects.
With Python2.4 I was looking into decorators. The examples from PEP 318
http://www.python.org/peps/pep-0318.html#examples
I've written a little application which uses the bang-line
#!/usr/bin/python
to call the interpreter. As python 2.4 comes distributed with other distroes
this breaks my application as its modules are installed
in /usr/local/lib/python2.3/site-packages/... and python2.4 does not look
there.
How
Hi,
I need to read in a text file which seems to be stored in some unknown
encoding. Opening and reading the files content returns:
f.read()
'\x00 \x00 \x00\x00l\x00o\x00g\x00E\x00n\x00t\x00r\x00y\x00...
Each character has a \x00 prepended to it. I suspect its some kind of
unicode - how do I
Hi,
I need a function returning a time value with a higher resolution that the
standard 1sec unix timestamp. I found the clock() function in the time
module, but that seems to return the same value (in the Python shell) each
time I call it (Debian Linux speaking here).
Any ideas?
Thanks,
Uwe
Hi,
can someone provide me with a running example for subclassing QWidget (or
something similarly simple) in C++ and then creating SIP (4.x+) bindings
for in for Python (2.3+)?
I am looking for something I can start of with and work my way towards more
complicated stuff (with Qt).
The QLabel
On Friday 28 January 2005 14:47 pm, Phil Thompson wrote:
The QLabel example in the SIP reference manual yields syntax errors for
me.
What syntax errors? If there is a documentation bug then I'll fix it.
I'll come to that a little later, that happened in the simple c++ word
example.
I am
On Friday 28 January 2005 14:24 pm, Craig Ringer wrote:
Out of curiosity, would this be for an extension module used in an
embedded Python interpreter, or for plain extension module for use with
a standalone interpreter?
I am writing an application program using Python and PyQt:
Friday 28 January 2005 23:18 pm Uwe Mayer wrote:
Traceback (most recent call last):
File stdin, line 1, in ?
ImportError: ./hello.so: undefined symbol: _ZTV5Hello
$ c++filt _ZTV5Hello
vtable for Hello
The compilation did not give any warnings or error messages. Any ideas?
$ ldd -d
Friday 28 January 2005 23:39 pm Uwe Mayer wrote:
Friday 28 January 2005 23:18 pm Uwe Mayer wrote:
Traceback (most recent call last):
File stdin, line 1, in ?
ImportError: ./hello.so: undefined symbol: _ZTV5Hello
$ c++filt _ZTV5Hello
vtable for Hello
The compilation did not give any
Saturday 29 January 2005 00:23 am Phil Thompson wrote:
So have you created the library you are trying to wrap? The documentation
is describing how to wrap a library and describes a fictional library as
the basis for the example.
No, the extracts from before are from the code example of the
Hi,
I am writing a Python application and use the GNU auto-tools to compile what
needs compilation (i.e. Qt's .ui files).
However, I don't know how to write an automake file that installs the main
file (lmc.py) and some library files (i.e. ClassA.py, ClassB.py) into the
appropriate directories.
Friday 21 January 2005 20:47 pm Reinhold Birkenfeld wrote:
[...]
The regular way is to use distutils and a setup.py file (google for
documentation).
Ok, thanks. The http://www.python.org/doc/2.3.4/dist/dist.html document
described just what I was looking for.
Any suggestions how I handle
Hi,
I need to access class variables of a class I'd like to make private:
i.e.
class __Bar(object):
pass
class __Foo(__Bar):
def __init__(self):
super(__Foo, self).__init__()
__Foo()
Name Error: global name '_Foo__Foo' is not defined
Here I want to prevent the user of instanciating
Hi,
well, I wrote a nice python program which won't work if the default encoding
has not been set from ascii to latin-1 or latin-15.
However, the command sys.setappdefaultencoding is missing on a Python
installation with Python 2.3.4 on Gentoo where it is present on Debian.
Any ideas how to
Hi,
I want to subclass list. The documentation states to prefer subclassing
list instead of UserList. How to you clear the contents of a list subclass
without creating a new object?
Thanks in advance
Uwe
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I use select() to wait for a file object (stdin) to become readable. In that
situation I wanted to read everything available from stdin and return to
the select statement to wait for more.
However, the file object's read method blocks if the number of bytes is 0 or
negative.
Is there no
38 matches
Mail list logo