2010/9/29 Lawrence D'Oliveiro :
> In message , 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.
>
>> ... or at least they don't print out
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 ascii
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
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
On Thu, Apr 22, 2010 at 7:49 AM, Zvezdan Petkovic 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
p_val
On Wed, Apr 21, 2010 at 3:15 PM, Brendan Miller 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
> pointe
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 string
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 fun
On Tue, Apr 20, 2010 at 11:38 AM, Robert Kern 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
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 t
On Wed, Apr 14, 2010 at 12:12 PM, Mark Dickinson wrote:
> On Apr 14, 7:09 pm, Brendan Miller 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
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. r"string" vs
R"string"?
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, Dec 18, 2009 at 2:47 PM, Bearophile 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 c
On Fri, Dec 18, 2009 at 10:39 AM, Carl Banks wrote:
> On Dec 17, 10:00 pm, Brendan Miller wrote:
>> On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano
>>
>> wrote:
>> > On Thu, 17 Dec 2009 12:07:59 -0800, Brendan Miller wrote:
>>
>> >> I was th
On Thu, Dec 17, 2009 at 6:44 PM, Steven D'Aprano
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
>> algori
On Thu, Dec 17, 2009 at 8:41 AM, Anh Hai Trinh 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
> this:
>
> x = [0
On Wed, Dec 16, 2009 at 12:38 PM, Anh Hai Trinh wrote:
> On Dec 16, 2:48 pm, Brendan Miller wrote:
>
>> No, that's what I'm getting at... Most of the existing mutating
>> algorithms in python (sort, reverse) operate over entire collections,
>> not partia
On Wed, Dec 16, 2009 at 4:16 AM, Paul Rudin wrote:
> Steven D'Aprano 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 making an unnecessary copy of almost all o
On Tue, Dec 15, 2009 at 9:09 PM, Terry Reedy 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 i
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 it
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
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
> 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
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 o
On Wed, Feb 18, 2009 at 1:34 AM, Chris Rebert wrote:
> On Wed, Feb 18, 2009 at 1:11 AM, Brendan Miller 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 quest
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
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 d
-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 v1
On Wed, Jan 21, 2009 at 8:19 AM, Scott David Daniels
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
On Tue, Jan 20, 2009 at 10:03 PM, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> "Rhodri James" 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 update without loc
On Tue, Jan 20, 2009 at 6:29 PM, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> "Rhodri James" 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).
>
> It would
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
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
> 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 aga
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
wrote:
> I saw some code where someone is
On Sat, Jan 17, 2009 at 7:57 PM, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> alex23 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 for
>> 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
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
> 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
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 th
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
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 t
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 see?
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
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
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 code
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
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 s
52 matches
Mail list logo