2010/9/29 Lawrence D'Oliveiro l...@geek-central.gen.new_zealand:
In message mailman.1132.1285714474.29448.python-l...@python.org, Brendan
Miller wrote:
It seems that characters not in the ascii subset of UTF-8 are
discarded by c_char_p during the conversion ...
Not a chance
I'm using python 2.5.
Currently I have some python bindings written in ctypes. On the C
side, my strings are in utf-8. On the python side I use
ctypes.c_char_p to convert my strings to python strings. However, this
seems to break for non-ascii characters.
It seems that characters not in the
I have a python script that sets up some environmental stuff. I would
then like to be able to change back to interactive mode and use that
environment. What's the best way to do that?
--
http://mail.python.org/mailman/listinfo/python-list
python -i myscript.py
almost does what I want. The only problem is if I exit with exit(0) it
does *not* enter interactive mode. I have to run off the end of the
script as near as I can tell. Is there another way to exit without
breaking python -i?
On Thu, May 20, 2010 at 4:57 PM, Brendan Miller
On Thu, Apr 22, 2010 at 7:49 AM, Zvezdan Petkovic zvez...@zope.com wrote:
On Apr 21, 2010, at 6:29 PM, Brendan Miller wrote:
Here's the method I was using. Note that tmp_char_ptr is of type
c_void_p. This should avoid the memory leak, assuming I am
interpreting the semantics of the cast
According to the ctypes docs: http://docs.python.org/library/ctypes.html
An errcheck function should return the args tuple when used with out
parameters (section 15.15.2.4. Function prototypes). However, in other
cases it says to return the result, or whatever result you want
returned from the
I have a function exposed through ctypes that returns a c_char_p.
Since I need to deallocate that c_char_p, it's inconvenient that
ctypes copies the c_char_p into a string instead of giving me the raw
pointer. I believe this will cause a memory leak, unless ctypes is
smart enough to free the
On Wed, Apr 21, 2010 at 3:15 PM, Brendan Miller catph...@catphive.net wrote:
I have a function exposed through ctypes that returns a c_char_p.
Since I need to deallocate that c_char_p, it's inconvenient that
ctypes copies the c_char_p into a string instead of giving me the raw
pointer. I
Python provides a GNU readline interface... since readline is a GPLv3
library, doesn't that make python subject to the GPL? I'm confused
because I thought python had a more BSD style license.
Also, I presume programs written with the readline interface would
still be subject to GPL... might want
On Tue, Apr 20, 2010 at 11:38 AM, Robert Kern robert.k...@gmail.com wrote:
On 4/20/10 1:09 PM, Brendan Miller wrote:
Python provides a GNU readline interface... since readline is a GPLv3
library, doesn't that make python subject to the GPL? I'm confused
because I thought python had a more BSD
On Wed, Apr 14, 2010 at 12:12 PM, Mark Dickinson dicki...@gmail.com wrote:
On Apr 14, 7:09 pm, Brendan Miller catph...@catphive.net wrote:
I'm using python 2.5.2.
I have a ctypes function with argtypes like this:
_create_folder.argyptes = [c_void_p, c_int]
Is that line a cut-and-paste
I'm using python 2.5.2.
I have a ctypes function with argtypes like this:
_create_folder.argyptes = [c_void_p, c_int]
The issue I am having is that I can call it like this
_create_folder(some_pointer, asdf)
and it won't raise a TypeError. Why would it accept a string for an
integer argument?
Thanks Steven and Gabriel. Those are very informative responses.
In my case my resource isn't bound to a lexical scope, but the:
def __del__(self,
delete_my_resource=delete_my_resource):
pattern works quite well. I've made sure to prevent my class from
being part of a circular
I'm used to C++ where destrcutors get called in reverse order of construction
like this:
{
Foo foo;
Bar bar;
// calls Bar::~Bar()
// calls Foo::~Foo()
}
I'm writing a ctypes wrapper for some native code, and I need to manage some
memory. I'm wrapping the memory in a python class
Is there any difference whatsoever between a raw string beginning with
the captical R or one with the lower case r e.g. rstring vs
Rstring?
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Dec 18, 2009 at 10:39 AM, Carl Banks pavlovevide...@gmail.com wrote:
On Dec 17, 10:00 pm, Brendan Miller catph...@catphive.net wrote:
On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller wrote
On Fri, Dec 18, 2009 at 2:47 PM, Bearophile bearophileh...@lycos.com wrote:
Brendan Miller:
I agree though, it doesn't matter to everyone and anyone. The reason I
was interested was because i was trying to solve some specific
problems in an elegant way. I was thinking it would be cool to make
On Thu, Dec 17, 2009 at 8:41 AM, Anh Hai Trinh anh.hai.tr...@gmail.com wrote:
I have a couple of thoughts:
1. Since [:] by convention already creates a copy, it might violate
people's expectations if that syntax were used.
Indeed, listagent returns self on __getitem__[:]. What I meant was
On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller wrote:
I was thinking it would be cool to make python more usable in
programming competitions by giving it its own port of the STL's
algorithm
On Wed, Dec 16, 2009 at 4:16 AM, Paul Rudin paul.nos...@rudin.co.uk wrote:
Steven D'Aprano st...@remove-this-cybersource.com.au writes:
I'm sympathetic to your request for list views. I've often wanted some
way to cleanly and neatly do this:
for item in seq[1:]:
process(item)
without
On Wed, Dec 16, 2009 at 12:38 PM, Anh Hai Trinh anh.hai.tr...@gmail.com wrote:
On Dec 16, 2:48 pm, Brendan Miller catph...@catphive.net wrote:
No, that's what I'm getting at... Most of the existing mutating
algorithms in python (sort, reverse) operate over entire collections,
not partial
I was trying to reimplement some of the c++ library of generic
algorithms in c++ in python, but I was finding that this is
problematic to do this in a generic way because there isn't any
equivalent of c++'s forward iterators, random access iterators, etc.
i.e. all python iterators are just input
On Tue, Dec 15, 2009 at 9:09 PM, Terry Reedy tjre...@udel.edu wrote:
On 12/15/2009 10:39 PM, Brendan Miller wrote:
I'm wondering if anyone has done work towards creating more powerful
iterators for python, or creating some more pythonic equivalent.
For sequences, integer indexes let you do
What's the point of PyHeapTypeObject in Include/object.h? Why does the
layout of object types need to be different on the heap vs statically
allocated?
Thanks,
Brendan
--
http://mail.python.org/mailman/listinfo/python-list
I have a python application that I want to package up and deploy to
various people using RHEL 4.
I'm using python 2.6 to develop the app. The RHEL 4 machines have an
older version of python I'd rather not code against (although that's
an option). My main stumbling block is I need to use a couple
platform. AFAICT there are RHEL4 rpms for these, and RHEL4 already comes
with its own version of Python so it seems you are attempting to make
things much more difficult than need be.
There are no rpm's in our repository for the third party modules I
need... If it was that easy I wouldn't be
So it sounds like the options are PyInstaller, cx_freeze, and
bbfreeze. Has anyone used any of these, and knows which one works best
on linux?
--
http://mail.python.org/mailman/listinfo/python-list
I'm just curious whether PyYaml is likely to end up in the standard
library at some point?
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Feb 18, 2009 at 1:34 AM, Chris Rebert c...@rebertia.com wrote:
On Wed, Feb 18, 2009 at 1:11 AM, Brendan Miller catph...@catphive.net wrote:
I'm just curious whether PyYaml is likely to end up in the standard
library at some point?
I don't personally have a direct answer to your
Like the title says.
--
http://mail.python.org/mailman/listinfo/python-list
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I have several version of python running side by side on my ubuntu
install (2.5,2.6,3.0).
I'm installing a module with a setup.py script, in this case
logilab-common, so that I can get pylint going. However, I need to
install into python 2.6, but by
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
If I:
import sys
sys = sys.version
This executes find but:
import sys
def f():
sys = sys.version
This gives an error indicating that the sys on the right hand side of =
is undefined. What gives?
-BEGIN PGP SIGNATURE-
Version: GnuPG
On Wed, Jan 21, 2009 at 8:19 AM, Scott David Daniels
scott.dani...@acm.org wrote:
Brendan Miller wrote:
On Tue, Jan 20, 2009 at 10:03 PM, Paul Rubin
http://phr.cx@nospam.invalid wrote:
Of course I'm aware of the LOCK prefix but it slows
down the instruction enormously compared
On Tue, Jan 20, 2009 at 3:46 AM, Paul Rubin
http://phr.cx@nospam.invalid wrote:
s...@pobox.com writes:
Carl, I'm quite unfamiliar with Boost and am not a C++ person, so may have
read what you saw but not recognized it in the C++ punctuation soup. I
couldn't find what you referred to. Can you
On Tue, Jan 20, 2009 at 6:29 PM, Paul Rubin
http://phr.cx@nospam.invalid wrote:
Rhodri James rho...@wildebst.demon.co.uk writes:
What cpu's do you know of that can atomically increment and decrement
integers without locking?
x86 (and pretty much any 8080 derivative, come to think of it).
On Tue, Jan 20, 2009 at 10:03 PM, Paul Rubin
http://phr.cx@nospam.invalid wrote:
Rhodri James rho...@wildebst.demon.co.uk writes:
You asked a question about CPUs with atomic update, strongly implying
there were none. All I did was supply a counter-example,
Well, more specifically, atomic
Constants would be a nice addition in python, sure enough.
My original question was about PEP-8 and whether it is pythonic to use
all caps to denote a variable that shouldn't be changed. More of a
style question than a language question.
I actually think *enforcing* constantness seems to go
Maybe I'm missing something here but a lock free algorithm for
reference counting seems pretty trivial. As long as you can atomically
increment and decrement an integer without locking you are pretty much
done.
For a reference implementation of lock free reference counting on all
common platforms
On Sat, Jan 17, 2009 at 7:57 PM, Paul Rubin
http://phr.cx@nospam.invalid wrote:
alex23 wuwe...@gmail.com writes:
Here's an article by Guido talking about the last attempt to remove
the GIL and the performance issues that arose:
I'd welcome a set of patches into Py3k *only if* the performance
Yes, I also recently noticed the bug in python's parser that doesn't
let it handle squigly braces and the bug in the lexer that makes white
space significant. I'm surprised the dev's haven't noticed this yet.
On Sat, Jan 17, 2009 at 2:09 AM, v4vijayakumar
vijayakumar.subbu...@gmail.com wrote:
I
The goals of the pypy project seems to be to create a fast python
implementation. I may be wrong about this, as the goals seem a little
amorphous if you look at their home page.
The home page itself is ambiguous, and does oversell the performance
aspect. The *actual* goal as outlined by
So I kind of wanted to ask this question on the pypy mailing list..
but there's only a pypy-dev list, and I don't want to put noise on the
dev list.
What's the point of RPython? By this, I don't mean What is RPython?
I get that. I mean, why?
The goals of the pypy project seems to be to create a
PEP 8 doesn't mention anything about using all caps to indicate a constant.
Is all caps meaning don't reassign this var a strong enough
convention to not be considered violating good python style? I see a
lot of people using it, but I also see a lot of people writing
non-pythonic code... so I
FOO = 1
def f(x=FOO):
...
Use this instead:
def f(x=1):
...
I tend to use constants as a means of avoiding the proliferation of
magic literals for maintenance reasons... Like say if your example of
FOO would have been used in 10 places. Maybe it is more pythonic to
simply denote
On Thu, Nov 13, 2008 at 3:54 AM, James Harris
[EMAIL PROTECTED] wrote:
On 11 Nov, 22:59, Brendan Miller [EMAIL PROTECTED] wrote:
What would heavy python unit testers say is the best framework?
I've seen a few mentions that maybe the built in unittest framework
isn't that great. I've heard
What would heavy python unit testers say is the best framework?
I've seen a few mentions that maybe the built in unittest framework
isn't that great. I've heard a couple of good things about py.test and
nose. Are there other options? Is there any kind of concensus about
the best, or at least how
How would I implement something equivalent to java's package private in
python?
Say if I have
package/__init__.py
package/utility_module.py
and utility_module.py is an implementation detail subject to change.
Is there some way to use __init__.py to hide modules that I don't want
clients to
I need a portable way to tell what subprocess.Popen will call.
For instance on unix systems, Popen will work for files flagged with the
executable bit, whereas on windows Popen will work on files ending the in
.exe extension (and I don't think anything else). Is there a portable way
to check what
Hi,
I have functions that take a file object and write to it. In some cases I
just want to throw out what is written to that file object. I want
something like open('/dev/null', 'w'), but portable.
It needs to have an underlying file descriptor/file handle, as it will be
passed to non python
On Fri, 02 May 2008 21:41:36 +0200, Christian Heimes wrote:
Brendan Miller schrieb:
Hi,
I have functions that take a file object and write to it. In some cases I
just want to throw out what is written to that file object. I want
something like open('/dev/null', 'w'), but portable
I want to spawn a child process based on an external executable that I have
the path for. I then want to wait on that executable, and capture it's
output.
In the os module, fork is only supported on unix, but spawn is only
supported on windows.
The os.system call is implemented by calling the C
On Fri, 02 May 2008 13:25:55 +1000, Ben Finney wrote:
URL:http://docs.python.org/lib/module-subprocess.html
Awesome. This is exactly what I was hoping existed.
--
http://mail.python.org/mailman/listinfo/python-list
52 matches
Mail list logo