On Sun, 06 Nov 2005 18:58:50 +, Tony Nelson wrote:
[snip]
> Is there a general way to call GLib functions?
ctypes?
http://starship.python.net/crew/theller/ctypes/
--
http://mail.python.org/mailman/listinfo/python-list
o I get the type as a string for comparison so I can do something
like
if type(some_data) == 'unicode':
do some stuff
else:
do something else
Regards,
David
--
http://mail.python.org/mailman/listinfo/python-list
datatype = datatype.encode("UTF-8")
n3 = '"%s"&<%s>' % (value, datatype)
else:
n3 = '"%s"' % value
return n3
else:
msg = "Unknown term Type for: %s" % term
rms, this functionality is provided by the standard
curses module. A similar module for Windows appears to be available at
http://www.effbot.org/zone/console-index.htm but I haven't tested it
out.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I assume I have to use a header somewhere (import WConio ?).
If you had tried it, you would have discovered that "import WConio" is
exactly what you need. Don't be afraid to experiment!
-- David
--
http://mail.python.org/mailman/listinfo/python-list
Tim Golden wrote:
> + PDF: David Boddie's pdftools looks like about the only possibility:
> (ducks as a thousand people jump on him and point out the alternatives)
I might as well do that! Here are a couple of alternatives:
http://www.sourceforge.net/projects/pdfplayground
http://w
s/urllib2.shtml
>
> All the best,
>
> Fuzzyman
> http://www.voidspace.org.uk/python/index.shtml
>
Excellent site!
/David
--
http://mail.python.org/mailman/listinfo/python-list
erence documentation whether something even smarter or more
highlevel exists. Fuzzyman's link did the trick. It also helped me
(after reading his articles) to understand the reference documentation
better.
/David
--
http://mail.python.org/mailman/listinfo/python-list
nteger, no __iadd__ method is provided, so a += b is equivalent
to a = a.__add__(b), which is a rebinding operation rather than a
modification.
This question (or variants thereof) is asked on an almost daily basis;
please search before posting.
-- David
--
http://mail.python.org/mailman/listinfo/
Include me in your list, please.
David
From: [EMAIL PROTECTED] (Alex Martelli)
To: python-list@python.org
Subject: Re: gmpy 1.01 rc near... anybody wanna test>
Date: Fri, 11 Nov 2005 07:10:01 -0800
MIME-Version: 1.0
Received: from smtp-vbr7.xs4all.nl ([194.109.24.27]) by mc10-f5.hotmail.
ct of dicts and in the dicts :)
If I could just say to Python: john and graham (and ...) are all a part
of a "superdict" and either their id or their name can be used as keys.
Can I do that somehow?
/David
--
http://mail.python.org/mailman/listinfo/python-list
rded.
Thus, I must express my gratitude to all of those programmers who
write open-source code (even if it doesn't go anywhere), and even
shareware, and other works which are made available and open at no or
reasonable cost. The Python community most of all.
A free and open marketplace
tivity flourishes and is justly rewarded.
Thus, I must express my gratitude to all of those programmers who
write open-source code (even if it doesn't go anywhere), and even
shareware, and other works which are made available and open at no or
reasonable cost. The Python community most of all
What is the best book for Python newbies (seasoned programmer in other
languages)?
/David
--
http://mail.python.org/mailman/listinfo/python-list
first post to this thread earlier today.
It follows at the end of this post.
On Nov 13, 2005, at 7:28 PM, Alex Martelli wrote:
> David T <[EMAIL PROTECTED]> wrote:
>...
>> Tom Edison moved to California so _he_ could skirt copyright laws of
>
> I'm not aware of any m
}}
My code so far. I guess my problem is how to generate a tuple dynamically when it is immutable?
Many thanks
David
cursor = db.cursor()
cursor.execute("""
SELECT * FROM countries;
""")
rows = cursor.fetchall()
vdict = {}
for row in range(len(rows)):
col_dict = {}
rllib2, that is, how to get
a persistent HTTP connection, instead of a new connection being opened
for every request?
/David
--
http://mail.python.org/mailman/listinfo/python-list
():
record_count += 1
vlist_dict[record_count] = tuple(record)
print vlist_dict
That's much better!
Regards
David
On Monday, November 14, 2005, at 07:58 AM, Fredrik Lundh wrote:
>
> but doesn't fetchall already returns tuples, btw? isn't something
> like
>
&
Thanks Fredrik for your help. Really short and efficient - very nice!
Regards,
David
On Monday, November 14, 2005, at 12:12 PM, Fredrik Lundh wrote:
> I meant to write
>
> d = {}
> for index, record in enumerate(cursor.fetchall()):
> d[index+1] = tuple(record)
&
ceive data" passes
before the connection is closed?
/David
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible to import a bitmap and stretch it to fit a defined area
with wxPython? If so, could someone point me to any relevent web
reference on the subject?
Thanks in advance
David
--
http://mail.python.org/mailman/listinfo/python-list
I need to be able to do this on the fly within a WX frame. I think I
have found it though. There is a resize function in the image class in
the _core code of wxPython. All I have to do now is learn how to
access the bugger. Syntax anyone ??
--
http://mail.python.org/mailman/listinfo/python-li
ften a better idea to ensure
that the child widgets have the sizes they need - their parent will
then be as large as they require.
Hope this helps,
David
--
http://mail.python.org/mailman/listinfo/python-list
'save.p','w'))
I don't really want to write to a file. I know I could write to sys.stdout.
But I'd rather collect the string and do some garbage collect, etc before I
exit the script.
Is there a way to have cPickle just hand me a string?
--
David Bear
-- let me buy yo
In the following example the phone number does not apear in the phone
column of the llistbox. Can anybody tell me what I am doing wrong here
?
from wxPython.wx import *
class MyApp (wxApp) :
def OnInit (self) :
frame = MyFrame(NULL, -1, "Phone List")
frame.Show(true)
self.Se
: func())[callable(func)]()
... but by that point, you're better off just using an if/then/else.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
r idea is to use exec(), don't know whether this is safe...
Any recommondations or tricks?
Thanks,
david
--
http://mail.python.org/mailman/listinfo/python-list
Great, this is exactly what I was looking for.
Thanks all of you for your immediate answer!
Nick Smallbone schrieb:
> David Duerrenmatt wrote:
>
>>Hi there
>>
>>For some reasons, I've to use Python 1.5.2 and am looking for a workaround:
>>
>>In new
y/python/
If you really, really want Python in a browser, it's certainly
possible. :)
-- David
--
http://mail.python.org/mailman/listinfo/python-list
What's the good way to produce a cumulative sum?
E.g., given the list x,
cumx = x[:]
for i in range(1,len(x)):
cumx[i] = cumx[i]+cumx[i-1]
What's the better way?
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> He seems to want scanl
Yes. But it's not in Python, right?
(I know about Keller's version.)
Robert Kern wrote:
> Define better. More accurate? Less code?
Good point.
As Bonono (?) suggested: I'd most like a solution that
relies on a
> Alan Isaac wrote:
>> Like SciPy's cumsum.
"Colin J. Williams" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Doesn't numarray handle this?
Sure.
One might say that numarray is in the process of becoming scipy.
But I was looking for a solution when these are available.
Something
Is there any way to have one program run another arbitrary program
with input from stdin and display the output as if you had run it in
a shell (i.e., you'd see some of the output followed by the input
they typed in and then a newline because they pressed return followed
by subsequent outp
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> >>> aList = ['a', 1, 'b', 2, 'c', 3]
> >>> it = iter(aList)
> >>> zip(it, it)
> [('a', 1), ('b', 2), ('c', 3)]
That behavior is currently an accident.
http://sourceforge.net/tracker/?group_id=5470&atid=105470&func=detail
_name__', 'cStringIO', 'email',
'getMessage', 'sys']
This is nothing like the documentation on python.org.
Any idea what I am missing?
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
--
http://mail.python.org/mailman/listinfo/python-list
Robert Kern wrote:
> David Bear wrote:
>> I'm confused about how to use the email module in python 2.4.x
>>
>> I'm using python packaged with suse 9.3.
>>
>>>From the module documetation at http://docs.python.org/lib/node597.html I
>> found th
he headers. Check to see if you have the file
/usr/include/python*/Python.h on your system.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
> Michael Spencer wrote:
> > This can be written more concisely as a generator:
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> If iterable has no elements, I believe the behaviour should be [init],
> there is also the case of init=None that needs to be handled.
Right. So it is "
"Michael Spencer" <[EMAIL PROTECTED]> wrote in message
news:mailman.1054.1132707811.18701.python-> This can be written more
concisely as a generator:
>
> >>> import operator
> >>> def ireduce(func, iterable, init):
> ... for i in iterable:
> ... init = func(init, i)
> ...
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> - allows arbitrary iterables, not sequences only
> - smaller memory footprint if sequential access to the items is sufficient
Sure; I meant aside from that.
> - fewer special cases, therefore
> - less error prone, e. g.
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Of course nothing can beat a plain old for loop in terms of readability
and
> -- most likely -- speed.
Here are two versions, meant to be comparable.
Thanks,
Alan Isaac
def cumreduce(func, seq, init = None):
cr = seq
from the file is done in C using a struct defined
in sys/acct.h.
http://www.linuxjournal.com/articles/lj/0104/6144/6144l2.html
So I was wondering how can I do the same thing, but in python? I'm
still learning so please be gentle.
David
--
http://mail.python.org/mailman/listinfo/python-list
Thanks but the C Struct describing the data doesn't match up with the
list on the module-struct page.
this is the acct.h file
#ifndef _SYS_ACCT_H
#define _SYS_ACCT_H 1
#include
#define __need_time_t
#include
#include
__BEGIN_DECLS
#define ACCT_COMM 16
/*
comp_t is a 16-bit "floating
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> You are in for a surprise here:
You got that right!
> >>> def empty():
> ... for item in []:
> ... yield item
> ...
> >>> bool(empty())
> True
Ouch.
> >>> bool(iter([]))
> True # python 2.3 and probably
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'd rather have a second look whether the test is really needed.
That's too obscure of a hint.
Can you be a bit more explicit?
Here's an example (below).
You're saying I think that most of it is unnecessary.
Thanks,
Alan
"Carl Waldbieser" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Does anyone know of any good examples for writing client side code to
upload
> files over a secure FTP connection?
http://trevp.net/tlslite/
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
or PyGtk.
You might also want to try PyQt:
http://www.riverbankcomputing.co.uk/pyqt/
I'm sure fans of wxWidgets will also point you in the direction of
their favourite bindings. ;-)
David
--
http://mail.python.org/mailman/listinfo/python-list
getting me into more unfamiliar
territory.
I'm sure there's a better way to do this; this seemed like "the
simplest thing that could possibly work".
-- David
#
# code_pickle.py
import sys, copy_reg, pickle, new, marshal, t
whitespace can mean one or more spaces, tabs, and
other characters)
As a second question, I am seeing string split as deprecated in 2.4.2
manual. What is planned in future to split (strings or unicode)?
Regards,
David
--
http://mail.python.org/mailman/listinfo/python-list
.
Regards,
David
On Saturday, November 26, 2005, at 11:42 AM, Fredrik Lundh wrote:
> Peter Otten wrote:
>
>>>>> [t.strip() for t in s.split(",") if t and not t.isspace()]
>> ['alpha', 'gamma', 'delta']
>
> footnote
Hi Fredrik. Good to know. Many thanks for your replies.
Regards
David
On Saturday, November 26, 2005, at 12:27 PM, Fredrik Lundh wrote:
> David Pratt wrote:
>
>> Also thanks for heads up for changes with method. I am
>> still using 2.3 but will move to 2.4 as soon a
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I think that the test for an empty iterator makes ireduce() unintuitive.
OK.
I misunderstood you point.
But that is needed to match the behavior of reduce.
>>> reduce(operator.add,[],42)
42
Thanks,
Alan
--
http://mail.
"Peter Otten" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> sufficiently similar
I think I understand your points now.
But I wanted to match these cases:
>>> import operator
>>> reduce(operator.add,[],42)
42
>>> reduce(operator.add,[1],42)
43
The idea is that the i-th yield of i
s
user0m0.502s
sys 0m0.004s
In both cases the total amount of data is equal but when I use shorter strings
it is much faster. Maybe it has nothing to do with Python unicode but I would
like to know the reason.
Thanks for notes!
David
--
http://mail.python.org/mailman/listinfo/python-list
Hi !
I've looked all over (internet, books, etc.) and I haven't found a very
good ressource to get started with wxPython (yes, I've been through
their tutorial).
What I would basically like to do for starters is to be able to define
the main panel being displayed. For example :
1. wxFrame cont
V Tue, 29 Nov 2005 10:14:26 +, Neil Hodgson napsal(a):
> David Siroky:
>
>> output = ''
>
> I suspect you really want "output = u''" here.
>
>> for c in line:
>> if not unicodedata.combining(c):
>>
see Half Life 2 in pure Python.
/David
--
http://mail.python.org/mailman/listinfo/python-list
Harald Armin Massa wrote:
> Dr. Armin Rigo has some mathematical proof, that High Level Languages
> like esp. Python are able to be faster than low level code like
> Fortran, C or assembly.
>
Faster than assembly? LOL... :)
/David
--
http://mail.python.org/mailman/listinfo/python-list
cking down this bugger.
Thanks,
--David
Command: vtkpython
Path:/sw/bin/vtkpython
Parent: bash [807]
Version: ??? (???)
PID:825
Thread: 0
Exception: EXC_BAD_ACCESS (0x0001)
Code[0]:0x000a
Code[1]:0x05770001
Thread 0 Crashed:
0 <<>>
advise a more efficient lookup when using lists of
dictionaries. Many thanks.
Regards
David
TEST_CONSTANTS = [
{'color':'red', 'shape':'octagon'},
{'color':'yellow', 'shape':'triangle'},
{'
This is a lot less clumsy and can easily be used in a class which is
very nice!
Many thanks bruno and Rob E for this good advice.
Regards,
David
On Monday, December 5, 2005, at 05:31 AM, bruno at modulix wrote:
> David Pratt wrote:
> (snip)
>> Can someone advise a more efficient
d with Python out of the box, then the
answer is not as far as I know, sorry.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
ls are represented as lists. So, then I need to strip the
[] from them, but then ... there must be an easier way.
Any advise?
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
--
http://mail.python.org/mailman/listinfo/python-list
print "INSERT INTO table (%s) VALUES (%%s);" % (",".join(fields),
*values)
^
SyntaxError: invalid syntax
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> David Bear wrote
>
>> Fredrik Lundh wrote:
>>
>> > cursor.execute(
>> > "INSERT INTO table (%s) VALUES (%%s);" % (",".join(fields)),
>> > *values
>> > )
>>
>> Thanks
Fredrik Lundh wrote:
> David Bear wrote
>
>> Fredrik Lundh wrote:
>>
>> > cursor.execute(
>> > "INSERT INTO table (%s) VALUES (%%s);" % (",".join(fields)),
>> > *values
>> > )
>>
>> Thanks
ly to widen.
> There's less and less reason to use assembler language with each passing
> year.
>
I've answered this question elsewhere in the thread.
/David
--
http://mail.python.org/mailman/listinfo/python-list
point. We're
talking about the best-case capabilities of a language. Writing programs
in other languages can be hard as well, not to mention writing a
compiler for any language that produces "as good as best assembly" code,
that is, optimal code.
/David
--
http://mail.python.org/mailman/listinfo/python-list
he same hardware. In fact, just win one.
Now, if you write the "fast" parts in C, you obviously can solve this
problem, and easily. But then there is no reason to discuss Python's
speed ever. Just say "as fast as C" and code everything in C and make a
hookup in Python. In fact, why not just code it in C then?
/David
--
http://mail.python.org/mailman/listinfo/python-list
n.
> And FWIW, I'd like to see any similar game in "pure" Java !-)
>
Me too :)
/David
--
http://mail.python.org/mailman/listinfo/python-list
you very much for the greater explanation. Yes, I was not
understanding that that %s in one instance was a python string format
operator, and in another instance it was a placeholder sent to the dbapi
objects (and I supposed on down into the data base cursor) for the
parameters following the function call. BIG DIFFERENCE.
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
>>
>>Write shorter functions ;)
>
> This has little to do with long functions. A class can contain
> a large number of methods, whitch are all rather short, and your
> class will still be spread over several pages.
>
Write classes with a sm
hon string object ends up being a properly type for postgresql. I've
bought 3 books on postgresql and none of th code samples demonstrate this.
web searchs for 'python sql escape string' yeild way too many results.
Any pointers would be greatly appreciated.
--
David Bear
-- let
...
The umask is not part of the environment, so there's no way to set it
directly through spawnle. Why don't you want to use os.umask?
-- David
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> David Bear wrote:
>
>> Being new to pgdb, I'm finding there are lot of things I don't understand
>> when I read the PEP and the sparse documentation on pgdb.
>>
>> I was hoping there would be a module that would properly esca
number 1, if the tape column it goes into is of type int
or num or float, will the DBAPI really know what to do with the newline?
--
David Bear
-- let me buy your intellectual property, I want to own your thoughts --
--
http://mail.python.org/mailman/listinfo/python-list
"Cameron Laird" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Jibes against the lambda-clingers lead eventually to serious
> questions of style in regard to variable namespacing,
> lifespan, cleanup, and so on:
>
http://groups.google.com/group/comp.lang.python/browse_th
>>> Jibes against the lambda-clingers lead eventually to serious
>>> questions of style in regard to variable namespacing,
>>> lifespan, cleanup, and so on:
>>>
http://groups.google.com/group/comp.lang.python/browse_thread/thread/ad0e15cb6b8f2c32/
Alan Isaac <[EMAIL PROTECTED]> wrote:
Scott David Daniels <[EMAIL PROTECTED]> writes:
> David Bolen wrote:
> > So for example, an asynchronous sequence of operations might be like:
> > d = some_deferred_function()
> > d.addCallback(lambda x: next_function())
> > d.addCallback(lambda bla
lguide.asp
This is mostly reference information, but there are some higher level
discussions of overall objects (e.g., worksheets, workbooks, cells,
etc...) too.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
Hello. I recently came across a free operating system called Unununium (or
something like that) and it was developed in Python and Assembly.
Now, I have been looking for a way to make an operating system for a long
long time and the only possibilities I could find were C++ and assembly. I
don't mi
ny database-specific features. Just requires a
little wrapper code for some functions
David
--
http://mail.python.org/mailman/listinfo/python-list
So how would I make an OS Shell?
--
http://mail.python.org/mailman/listinfo/python-list
a
certain extent, would bring to the language. Sadly we don't have that,
yet. :)
David.
--
http://mail.python.org/mailman/listinfo/python-list
I just did this fine for python 2.3 on whitebox linux).
David
--
http://mail.python.org/mailman/listinfo/python-list
How does one query the python environment, ie pythonhome, pythonpath,
etc.
also, are there any HOWTO's on keeping multiple versions of python
happy?
--
http://mail.python.org/mailman/listinfo/python-list
l thread
protection around that data, so that you can use your own locks rather
than depending on the GIL.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
d state from a
native C application thread (not initiated by the Python interpreter)
to allow me to call safely into an executing Python script upon
asynchronous data reception by the C code.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
perfectly well as
a list even after the mutations - just no longer delivering objects in
sorted order.
-- David
--
http://mail.python.org/mailman/listinfo/python-list
w_distutils_remove_source in the module and it
does the neccessary changes. Then you get a --remove-source options to
most of the commands. You can also selectively override what gets
removed if you want by changing the is_removable function
I hope this is useful for what you're wanting to do
Da
[lst]
>
> Should print:
> Hi
> Hi
> Hi
> Hi
Yes, and what should the following do?
lst1 = [1]
lst2 = [2]
dct = {lst1: "1", lst2: "2"}
lst2[0]=1
lst1[0]=2
print dct[[1]]
print dct[[2]]
--
David Eppstein
Computer Science Dept., Univ. of California, Irvine
http://www.ics.uci.edu/~eppstein/
--
http://mail.python.org/mailman/listinfo/python-list
ample http://adodbapi.sourceforge.net/
That way if you want to switch to a different database you can more
easily...
David
--
http://mail.python.org/mailman/listinfo/python-list
Yun Mao wrote:
>a[ [1,0], [0,1] ] , which should give me
>[[4, 5], [1,2]]
Numeric:
take(take(a,[1,0]),[0,1],1)
fwiw,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
> Is it possible to create own statements, such that it would be
possible to do:
>
> printDebug "test"
>
> ?
This question is well addressed in a neighbour group comp.lang.lisp .
--
http://mail.python.org/mailman/listinfo/python-list
Sara Fwd wrote:
Hi all
Is there a module for processing & handling '.po'
files in python?
If you want to do anything beyond standard gettext (which is handled by
the gettext module) there's lots of code at translate.sourceforge.net ...
David
--
http://mail.python.org/mail
I'm looking for Python code to extract files
from MS-TNEF attachments. (I'm aware
of the C code at http://tnef.sourceforge.net/ )
Thanks,
Alan Isaac
--
http://mail.python.org/mailman/listinfo/python-list
PCs without the
> python interpreter.
> hope you help me, thanks alot!
If you are under Microsoft Windows (which I guess, according your question),
you may use py2exe ( http://starship.python.net/crew/theller/py2exe/ ).
It will do all the required stuff for you to have a standalone execut
et managed this simple operation.
Note that I have no access to the dll source code, so I cannot modify it so
it uses a named pipe (for example) as message output pipe instead os
stdout...
Thanks,
David
--
http://mail.python.org/mailman/listinfo/python-list
hine?
Windows also has package management in the form of Windows Installer, it
would be better to use that on windows than simply look in locations...
David
--
http://mail.python.org/mailman/listinfo/python-list
= '192.168.0.99'
class DEV0(DEFAULT):
path = '192.168.0.0'
class DEV1(DEFAULT):
path = '192.168.0.1'
This seems to me to bear more logical structure resemblance to the
ini-style format.
Otherwise really cool!
David
--
http://mail.python.org/mailman/listinfo/python-list
901 - 1000 of 3822 matches
Mail list logo