On 28 Feb, 02:24, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
Python doesn't do call by reference. Nor does it do call by value. Please
pay no attention to anyone who says it does.
Exactly. Python pass variables the same way as Lisp, which is neither
call-by-value (cf. C) nor
On 28 Feb, 02:24, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
Python doesn't do call by reference. Nor does it do call by value. Please
pay no attention to anyone who says it does.
Exactly. Python pass variables the same way as Lisp, which is neither
call-by-value (cf. C) nor
On 13 Mar, 09:22, Antoon Pardon [EMAIL PROTECTED] wrote:
Whatever python has for a calling convention, it is close enough that
naming it call by reference gives people a reasonable idea of what
is going on.
Only to the extent that many mistake passing Java or C# reference
types for
On 15 Mar, 21:35, mpc [EMAIL PROTECTED] wrote:
generator embedded in the argument only once. Can anyone explain while
the generator will not re-initiate, and suggest a simple fix?
I am not sure what you are trying to do, but it seems a bit confused.
def concat(seq):
for s in seq:
On 15 Mar, 22:43, Guido van Brakel [EMAIL PROTECTED] wrote:
def gem(a):
g = sum(a) / len(a)
return g
It now gives a int, but i would like to see floats. How can integrate
that into the function?
You get an int because you are doing integer division. Cast one int to
float.
def
On 15 Mar, 22:43, Guido van Brakel [EMAIL PROTECTED] wrote:
def gem(a):
g = sum(a) / len(a)
return g
print gem([1,2,3,4])
print gem([1,10,100,1000])
print gem([1,-2,3,-4,5])
gem( map(float,[1,2,3,4]) )
gem( float(i) for i in [1,2,3,4] )
--
On 16 Mar, 15:32, [EMAIL PROTECTED] wrote:
It seems the development of Cython is going very well, quite
differently from the dead-looking Pyrex. Hopefully Cython will become
more user-friendly too (Pyrex is far from being user-friendly for
Windows users, it doesn't even contain a compiler, I
On 16 Mar, 16:58, [EMAIL PROTECTED] wrote:
I think lot of Win users (computational biologists?), even people that
know how to write good Python code, don't even know how to install a C
compiler.
If you don't know how to install a C compiler like Microsoft Visual
Studio, you should not be
On 16 Mar, 18:10, sturlamolden [EMAIL PROTECTED] wrote:
You don't click on compiled Python C extensions. You call it from your
Python code.
By the way, disttools will invoke Pyrex and the C compiler, and
produce the binary .pyd-file you can access from Python. It's not
rocket science (not even
On 16 Mar, 17:25, Guido van Brakel [EMAIL PROTECTED] wrote:
Why is this not working,and how can I correct it?
[code skipped]
There is no way of correcting that. Delete it and start over.
--
http://mail.python.org/mailman/listinfo/python-list
On 16 Mar, 18:23, Martin Blume [EMAIL PROTECTED] wrote:
This seems to imply that the Mac, although running now on Intel
processors, is still big-endian.
Or maybe the struct module thinks big-endian is native to all Macs? It
could be a bug.
--
On 13 Mar, 20:40, Tobiah [EMAIL PROTECTED] wrote:
I checked out the array module today. It claims that
arrays are 'efficient'. I figured that this must mean
that they are faster than lists, but this doesn't seem
to be the case:
one.py ##
import array
a =
On 15 Mar, 21:54, Unknown [EMAIL PROTECTED] wrote:
I was expecting to replace the old value (serial) with the new one
(todayVal). Instead, this code *adds* another line below the one found...
How can I just replace it?
A file is a stream of bytes, not a list of lines. You can't just
replace
On 17 Mar, 04:54, WaterWalk [EMAIL PROTECTED] wrote:
So I'm curious how to read code effectively. I agree that python code
is clear, but when it becomes long, reading it can still be a hard
work.
First, I recommend that you write readable code! Don't use Python as
if you're entering the
On 18 Mar, 08:00, hellt [EMAIL PROTECTED] wrote:
under Microsoft Visual Studio do you mean IronPython instance?
AFAIK, with the latest VS 2008 you can develop for CPython and
IronPython.
http://blogs.msdn.com/haibo_luo/archive/2007/10/16/5482940.aspx
--
On 18 Mar, 00:58, Jeff Schwab [EMAIL PROTECTED] wrote:
def make_slope(distance, parts):
if parts == 0:
return []
q, r = divmod(distance, parts)
if r and parts % r:
q += 1
return [q] + make_slope(distance - q, parts - 1)
Beautiful. If Python could
On 18 Mar, 17:48, Miki [EMAIL PROTECTED] wrote:
Apart from PIL, some other options are:
1. Most GUI frameworks (wxPython, PyQT, ...) give you a canvas object
you can draw on
Yes, but at least on Windows you will get a GDI canvas. GDI is slow.
2. A bit of an overkill, but you can use
On 18 Mar, 10:57, Simon Forman [EMAIL PROTECTED] wrote:
def f(L):
'''Return a set of the items that occur more than once in L.'''
L = list(L)
for item in set(L):
L.remove(item)
return set(L)
def nonunique(lst):
slst = sorted(lst)
return list(set([s[0] for s
On 18 Mar, 22:22, sturlamolden [EMAIL PROTECTED] wrote:
def nonunique(lst):
slst = sorted(lst)
return list(set([s[0] for s in
filter(lambda t : not(t[0]-t[1]), zip(slst[:-1],slst[1:]))]))
Or perhaps better:
def nonunique(lst):
slst = sorted(lst)
return list(set([s[0
On 18 Mar, 22:25, sturlamolden [EMAIL PROTECTED] wrote:
def nonunique(lst):
slst = sorted(lst)
return list(set([s[0] for s in
filter(lambda t : t[0] != t[1], zip(slst[:-1],slst[1:]))]))
Obviously that should be 'lambda t : t[0] == t[1]'. Instead of using
the set function
On 18 Mar, 23:45, Arnaud Delobelle [EMAIL PROTECTED] wrote:
def nonunique(lst):
slst = sorted(lst)
dups = [s[0] for s in
filter(lambda t : t[0] == t[1], zip(slst[:-1],slst[1:]))]
return [dups[0]] + [s[1] for s in
filter(lambda t : t[0] != t[1],
On 19 Mar, 09:40, grbgooglefan [EMAIL PROTECTED] wrote:
How do I create hash map in Python?
Python dictionaries are the fastest hash maps known to man.
If you need persistent storage of your hash map, consider module bsddb
or dbhash.
--
http://mail.python.org/mailman/listinfo/python-list
On 19 Mar, 09:44, Torsten Bronger [EMAIL PROTECTED]
wrote:
Could you elaborate on this? (Sincere question; I have almost no
idea of Haskell.)
If you already know Python, you will find Whitespace just as useful as
Haskell.
--
http://mail.python.org/mailman/listinfo/python-list
On 19 Mar, 22:48, John Machin [EMAIL PROTECTED] wrote:
I'd use Raymond Hettinger's solution. It is as much O(N) as Paul's,
and is IMHO more readable than Paul's.
Is a Python set implemented using a hash table?
--
http://mail.python.org/mailman/listinfo/python-list
On 20 Mar, 00:16, John Machin [EMAIL PROTECTED] wrote:
What don't you understand about the comments in the first two
screenfuls of Objects/setobject.c?
I had not looked at it, but now I have. Is seems Hettinger is the
author :) Ok, so sets are implemented as hash tables. Then I agree,
use
On 20 Mar, 08:39, Daniel Fetchinson [EMAIL PROTECTED]
wrote:
Thoughts anyone?
I don't use tk myself, but scheduling tkinter for vaporization would
be a bad idea. A lot of programs depend on it, and it doesn't look
ugly anymore (the one that ship with Python still does).
Would inclusion of
I just discovered wxFormBuilder. After having tried several GUI
builders for wx (including DialogBlocks, wxGlade, XRCed, Boa
constructor), this is the first one I can actually use.
To use it wxFormBuilder with wxPython, I generated an xrc resource and
loaded it with wxPython. All the tedious GUI
On 20 Mar, 15:11, Ahmed, Shakir [EMAIL PROTECTED] wrote:
I have a Microsoft Access database that I want to delete whether anyone
is using that file.
The database is already read only mode residing in a server, users are
opening in read only mode. I want to delete that file, I remove read
On 20 Mar, 17:21, Stef Mientki [EMAIL PROTECTED]
wrote:
I've tried several of the above mentioned builders,
with the same result.
I've also looked at wxFormBuilder,
but I found it far too difficult and
fully unreadable (how can you create actions/bindings on components you don't
see ?).
On 20 Mar, 17:21, Stef Mientki [EMAIL PROTECTED]
wrote:
I've tried several of the above mentioned builders,
with the same result.
I've also looked at wxFormBuilder,
but I found it far too difficult and
fully unreadable (how can you create actions/bindings on components you don't
see ?).
On 20 Mar, 19:09, Craig [EMAIL PROTECTED] wrote:
The culprit i here:
Before - X = 0, CacheSize = 0, OpenMode = 3, vHandle = 0
This binds these names to Python ints, but byref expects C types.
Also observe that CacheSize and OpenMode should be c_short.
--
On 20 Mar, 19:09, Craig [EMAIL PROTECTED] wrote:
The following is the C++ prototype for one of the functions:
short FAR PASCAL VmxOpen(BSTR*Filespec,
LPSHORT lpLocatorSize,
LPSHORT lpOmode,
LPHANDLE lphwmcb,
On 22 Mar, 09:31, Bryan Olson [EMAIL PROTECTED] wrote:
Even a hash function that behaves as a random oracle has
worst-case quadratic-time in the algorithm here
In which case inserts are not amortized to O(1).
--
http://mail.python.org/mailman/listinfo/python-list
On 22 Mar, 14:48, llandre [EMAIL PROTECTED] wrote:
- it must run both on linux and windows PC
- it must interact with an electronic device connected to the PC through
serial cable
Python should be fine.
- initially the program must be written in the form of simple command
line tool that is
On 22 Mar, 08:10, CM [EMAIL PROTECTED] wrote:
Why can't you use Boa Constructor? I really enjoy using it.
It feels awkward. I don't know why.
--
http://mail.python.org/mailman/listinfo/python-list
On 22 Mar, 23:42, 7stud [EMAIL PROTECTED] wrote:
Beginning programmers in grades 9-12 are not going to understand
issues like that, and it would be a mistake to try and introduce
them. Beginning programmers should be concentrating their efforts on
learning the syntax of a language and basic
On 28 Mar, 15:52, [EMAIL PROTECTED] wrote:
I'm having trouble explaining the benefits and tradeoffs of threads to my
coworkers and countering their misconceptions about Python's threading model
and facilities.
Python's threading module is modelled on Java's thread model. There
are some
This is good news, particularly the NumPy support for surface and
pixel arrays.
--
http://mail.python.org/mailman/listinfo/python-list
On 30 Mar, 17:16, iu2 [EMAIL PROTECTED] wrote:
Due to Competitors... I don't want to expost the language I use
Either your comepetitors will figure it out, or they don't care. Using
Python can be a major competitive advance. If your competitors are
smart enough to realise that, you are in
On 30 Mar, 22:21, [EMAIL PROTECTED] wrote:
Hello everybody,
I'm building a python module to do some heavy computation in C (for
dynamic time warp distance computation).
Why don't you just ctypes and NumPy arrays instead?
# double timewarp(double x[], int lenx, double y[], int leny);
import
On 31 Mar, 20:52, kim [EMAIL PROTECTED] wrote:
array_pointer_t = ndpointer(dtype=c_double)
This one is wrong. The dtype should be the datatype kept in the array,
which is 'float' (Python doubles) or 'numpy.float64'.
array_pointer_t = ndpointer(dtype=numpy.float64)
I'd take a good look at
On Apr 2, 1:26 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
It did *not* say that it supports every existing, more powerful and
generally better asynchronous mechanism supported by any OS out there.
Even though it would certainly be nice if it did :)
Python's standard library should have an
On Apr 5, 12:58 am, [EMAIL PROTECTED] wrote:
Is it possible for someone to provide the information on the steps
necessary to access this DLL and treat it like any other pyd library?
Maybe there is already a tutorial available for performing this task?
Is this task straight forward?
Short
On Apr 11, 8:35 pm, Steve Holden [EMAIL PROTECTED] wrote:
wxDesigner.
IMHO, wxFormBuilder is better.
http://wxformbuilder.org/
http://preview.tinyurl.com/6l8wp4
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 12, 12:32 am, Rune Strand [EMAIL PROTECTED] wrote:
produce what I want without _wasting life_. But Boa is too unstable,
and does not claim otherwise, and there's no descent alternative I'm
aware of.
wxFormDesigner is the best there is for wx. QtDesigner ditto for Qt.
Glade ditto for
On Apr 11, 5:01 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
Another annoying thing with the Qt license is that you have to choose it
at the very start of the project. You cannot develop something using the
open source license and later decide to switch to the commercial licence
and buy it.
On Apr 11, 6:24 pm, [EMAIL PROTECTED] wrote:
Do I wind up with two completely independent interpreters, one per thread?
I'm thinking this doesn't work (there are bits which aren't thread-safe and
are only protected by the GIL), but wanted to double-check to be sure.
You can create a new
On Apr 11, 6:24 pm, [EMAIL PROTECTED] wrote:
Do I wind up with two completely independent interpreters, one per thread?
I'm thinking this doesn't work (there are bits which aren't thread-safe and
are only protected by the GIL), but wanted to double-check to be sure.
You can create a new
On Apr 12, 7:05 pm, sturlamolden [EMAIL PROTECTED] wrote:
In theory, a GIL private to each (sub)interpreter would make Python
more scalable. The current GIL behaves like the BKL in earlier Linux
kernels. However, some third-party software, notably Apache's
mod_python, is claimed to depend
On Apr 15, 7:23 pm, [EMAIL PROTECTED] wrote:
test = [[1],[2]]
x = test[0]
Python names are pointer to values. Python behaves like Lisp - not
like Visual Basic or C#.
Here you make x point to the object which is currently pointed to by
the first element in the list test. If you now reassign
On Apr 15, 8:19 pm, [EMAIL PROTECTED] wrote:
Coming from VBA I have a tendency to think of everything as an
array...
Coding to much in Visual Basic, like Fortran 77, is bad for your mind.
--
http://mail.python.org/mailman/listinfo/python-list
Hello Guys...
I just had one moment of exceptional clarity, during which realized
how I could get the GIL out of my way... It's so simple, I cannot help
wondering why nobody has thought of it before. Duh! Now I am going to
sit and and marvel at my creation for a while, and then go to bed
(it's
On Apr 16, 4:17 am, [EMAIL PROTECTED] wrote:
Reformulating my question:
Which GUI tool, wxPython or PyQt, is more pythonic? (Please, ignore
the license issue because I am thinking about FOSS)
None of them, all three of them (you forgot PyGTK), or it doesn't
matter more. Nobody with their
On 17 Apr, 15:21, Martin P. Hellwig [EMAIL PROTECTED] wrote:
If not, what is the advantage above already present solutions?
Well... I like the processing module. Except that Wintendo toy OS has
no fork() availabe for the Win32 subsystem, which makes it a bit
limited on that platform (slow at
On 17 Apr, 10:25, Martin v. Löwis [EMAIL PROTECTED] wrote:
help progress at all. I think neither was the case in this thread -
the guy claimed that he actually did something about the GIL, and
now we are all waiting for him to also tell us what it is that he
did.
Ok, I did not remove the
On 17 Apr, 09:11, Matias Surdi [EMAIL PROTECTED] wrote:
It's april 1st again???
Not according to my calendar. This was not meant as a joke. I think I
may have solved the GIL issue. See my answer to Martin v. Löwis for a
full explanation.
--
http://mail.python.org/mailman/listinfo/python-list
On 17 Apr, 10:12, Steve Holden [EMAIL PROTECTED] wrote:
Quick, write it down before the drugs wear off.
Hehe, I don't take drugs, apart from NSAIDs for arthritis. Read my
answer to Martin v. Löwis.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 17, 5:46 pm, Hrvoje Niksic [EMAIL PROTECTED] wrote:
Have you tackled the communication problem? The way I see it, one
interpreter cannot see objects created in the other because they
have separate pools of ... everything. They can communicate by
passing serialized objects through
On Apr 17, 6:03 pm, Rhamphoryncus [EMAIL PROTECTED] wrote:
Interesting. Windows specific, but there's other ways to do the same
thing more portably.
I believe you can compile Python as a shared object (.so) on Linux as
well, and thus loadable by ctypes.
The bigger issue is that you can't
On Apr 17, 7:16 pm, Jonathan Gardner [EMAIL PROTECTED]
wrote:
On Apr 17, 8:19 am, sturlamolden [EMAIL PROTECTED] wrote:
An there you have the answer. It's really very simple :-)
That's an interesting hack.
Now, how do the processes communicate with each other without stepping
on each
On 18 Apr, 21:28, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Passing a NULL SectionHandle to NTCreateProcess/CreateProcessEx
results in a fork-style copy-on-write duplicate of the current process.
I know about NtCreateProcess and ZwCreateProcess, but they just create
an empty process - no
On Apr 17, 4:06 pm, AlFire [EMAIL PROTECTED] wrote:
Q: why function got dictionary? What it is used for?
As previously mentioned, a function has a __dict__ like (most) other
objects.
You can e.g. use it to create static variables:
int foobar()
{
static int i = 0;
return i++;
}
is
On Apr 19, 8:33 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
barfoo = foobar
foobar = lambda x : x
And boom.
That's why I used the qualifier 'roughly equivalent' and not simply
'equivalent'.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 19, 10:29 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
FWIW, NT's POSIX subsytem fork() uses (or used to use) the NULL
SectionHandle method and was POSIX certified, so it's certainly
possible.
Windows Vista Ultimate comes with Interix integrated, renamed
'Subsystem for Unix based
On Apr 20, 2:46 pm, Hank @ITGroup [EMAIL PROTECTED] wrote:
That is my question, after ``del``, sometimes the memory space returns
back as nothing happened, sometimes not... ...
What exactly was happening???
Python has a garbage collector. Objects that cannot be reached from
any scope is
On Apr 20, 5:28 pm, JB Stern [EMAIL PROTECTED] wrote:
Curious Steve, how do you pay the rent and by what authority do you
speak for The Python world? Your opinion couldn't be more wrong for
programmers like myself who live by the code they write (as opposed to
its support).
Are you afraid
On Apr 20, 9:09 pm, Hank @ITGroup [EMAIL PROTECTED] wrote:
Could you please give us some clear clues to obviously call python to
free memory. We want to control its gc operation handily as we were
using J**A.
If you want to get rid of a Python object, the only way to do that is
to get rid of
On Apr 20, 8:49 pm, Roy Smith [EMAIL PROTECTED] wrote:
Hiding your source code is not easy (perhaps impossible) in Python, for
reasons which have been covered at length on a regular basis in this forum.
If you only ship .pyc or .pyo files, there is still enough information
recoverable in the
On Apr 21, 12:25 am, Zethex [EMAIL PROTECTED] wrote:
Anyway the amount of [[]] do increase over time. Im just wondering is there
a simple way to add these together so they become 1 simple list, so it would
be ['computer''asus'] etc without the nested list. Its random the
amount each
On Apr 21, 12:25 am, Zethex [EMAIL PROTECTED] wrote:
Anyway the amount of [[]] do increase over time.
You can flatten a nested list using a closure and recursion:
def flatten(lst):
tmp = []
def _flatten(lst):
for elem in lst:
if type(elem) != list:
On Apr 21, 2:35 am, sturlamolden [EMAIL PROTECTED] wrote:
This also shows how easy it is to boost the performance of Python code
using Cython.
We can improve this further by getting rid of the tmp.append attribue
lookup:
cdef _flatten(lst, append):
for elem in lst:
if type(elem
On Apr 21, 4:09 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
I'm not sure if this will help the OP at all - going into a world of dangling
pointers, keeping track of ownership, releasing memory by hand... One of the
good things of Python is automatic memory management. Ensuring that all
On Apr 22, 2:00 am, Mitko Haralanov [EMAIL PROTECTED] wrote:
As far as I know, I have done everything by the book yet I can't seem
to figure out where the problem is. Any help would be great?
Albeit not having looked at your code in detail, I'm wiling to bet you
have one of the refcounts
On Apr 22, 12:52 pm, Harishankar [EMAIL PROTECTED] wrote:
Sorry to start off on a negative note in the list, but I feel that the Python
subprocess module is sorely deficient because it lacks a mechanism to
Have you looked at the processing module in cheese shop?
--
On Apr 22, 8:36 pm, Kenneth McDonald
[EMAIL PROTECTED] wrote:
Sadly.
I can easily access:
http://www.crummy.com/software/BeautifulSoup/
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 27, 4:44 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote:
PyPy is self-hosted and has been for some time (a year or so?).
This is technically not correct. PyPy is hosted by RPython, which is
not Python but a different language all together.
--
On Mar 27, 4:02 pm, king kikapu [EMAIL PROTECTED] wrote:
As for psyco, are there any alternatives to use now ?
When Cython has implemented all of Python's syntax, we can replace
CPython's compiler and bytecode interpreter with Cython and a C
compiler. Cython can be one or two orders of
On Mar 27, 5:01 pm, king kikapu [EMAIL PROTECTED] wrote:
Hmmm...thanks but i think Pyrex-like solution is not the ideal one.
Coming from C# and having 8 years of expertise on it, i have gain a
very positive thinking about jit compilers and i think that psyco (ok,
a just-in-time specializer)
On Mar 27, 5:01 pm, king kikapu [EMAIL PROTECTED] wrote:
Hmmm...thanks but i think Pyrex-like solution is not the ideal one.
Coming from C# and having 8 years of expertise on it, i have gain a
very positive thinking about jit compilers and i think that psyco (ok,
a just-in-time specializer)
On Apr 25, 2:15 am, Steve Holden [EMAIL PROTECTED] wrote:
I believe, without the benefit of recent experience, that the R stands
for Restricted. Thus and RPython program must of necessity also be a
valid Python program. Or do you know something I don't?
That is correct. But RPython is not
On Mar 28, 8:06 pm, Paul Boddie [EMAIL PROTECTED] wrote:
From what I've seen from browsing publicly accessible materials,
there's a certain commercial interest in seeing Psyco updated
somewhat.
YouTube uses Psyco.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 25, 3:27 am, Steve Holden [EMAIL PROTECTED] wrote:
That seems a little harsh: it's Python-in-a-strait-jacket.
The fact remains that since RPython programs also run under the standard
interpreter (albeit a factor of maybe a hundred times more slowly) their
claim of self-hosting is
On Apr 22, 1:07 pm, GD [EMAIL PROTECTED] wrote:
Please remove ability to multiple inheritance in Python 3000.
Too late for that, PEPs are closed.
Multiple inheritance is bad for design, rarely used and contains many
problems for usual users.
Every program can be designed only with single
On Apr 24, 5:51 am, Nick Stinemates [EMAIL PROTECTED] wrote:
I don't understand how the 2 are mutually exclusive?
You can have PHP and Python bindings installed on the same Apache
server, unless I'm mistaken?
Not everyone have the luxury of having mod_python installed. It
depends on the
On Apr 25, 4:57 am, Steve Holden [EMAIL PROTECTED] wrote:
I am simply pointing out that RPython is used for efficiency, not to do
things that can't be done in standard Python.
Yes. And if we only use a very small subset of Python, it would in
effect be a form of assembly code. Hence my comment
On Apr 25, 5:09 am, Jack [EMAIL PROTECTED] wrote:
typedef struct
{
char *country_short;
char *country_long;
char *region;
char *city;
char *isp;
float latitude;
float longitude;
char *domain;
char *zipcode;
char *timezone;
char *netspeed;
} IP2LocationRecord;
First
On Apr 25, 5:15 am, sturlamolden [EMAIL PROTECTED] wrote:
First define a struct type IP2LocationRecord by subclassing from
ctypes.Structure. Then define a pointer type as
ctypes.POINTER(IP2LocationRecord) and set that as the function's
restype attribute. See the ctypes tutorial or reference
On Apr 25, 5:39 am, Jack [EMAIL PROTECTED] wrote:
AttributeError: 'LP_IP2LocationRecord' object has no attribute
'country_short'
As it says, LP_IP2LocationRecord has no attribute called
'country_short'. IP2LocationRecord does.
Use the 'contents' attribute to dereference the pointer. That is:
On Apr 25, 5:39 am, Jack [EMAIL PROTECTED] wrote:
IP2Location_get_all.restype = POINTER(IP2LocationRecord)
IP2LocationObj = IP2Location_open(thisdir + '/IP-COUNTRY-SAMPLE.BIN')
rec = IP2Location_get_all(IP2LocationObj, '64.233.167.99')
print rec.country_short
print rec.contents.country_short
On Apr 25, 2:03 pm, Bjoern Schliessmann usenet-
[EMAIL PROTECTED] wrote:
That's how the Java designers were thinking as well: If MI is
allowed, programmers will suddenly get an irresistible urge to use
MI to write unmaintainable spaghetti code. So let's disallow MI
for the sake of common
On Apr 25, 4:38 pm, Gabriel Rossetti
[EMAIL PROTECTED] wrote:
Hello,
I'm having some trouble with the Queue class, for some reason, if I do
this (ch == ) :
q = Queue.Queue(0)
repr(ch)
q.put(ch, True)
len(q.queue)
from Queue import Queue
q = Queue(0)
s = '\x02'
q.put(s,True)
On Apr 23, 9:13 pm, [EMAIL PROTECTED] wrote:
A simple yet dangerous and rather rubbish solution (possibly more of a
hack than a real implementation) could be achieved by using a
technique described above:
?php
echo exec('python foo.py');
This will spawn a Python interpreter, and
On Apr 23, 9:08 pm, MC [EMAIL PROTECTED] wrote:
If you are under Windows, you can:
- call Python's functions via Active-Scripting
- call a Python COM server (functions or properties)
For that, use Pywin32. And, in all cases, call functions can use
parameters.
This is perhaps the
On Apr 30, 8:06 pm, L. Lindstrom [EMAIL PROTECTED] wrote:
I have read that Python extension modules must link to the same C
run-time as the Python interpreter. This I can appreciate. But does this
requirement extend to the C libraries an extension module wraps.
This somewhat of a
On May 3, 10:13 pm, hdante [EMAIL PROTECTED] wrote:
I believe that moving this to third party could be better. What about
numpy ? Doesn't it already have something similar ?
Yes, Kahan summation makes sence for numpy arrays. But the problem
with this algorithm is optimizing compilers. The
On May 18, 12:32 am, Vicent Giner [EMAIL PROTECTED] wrote:
* As far as I understand, the fact that Python is not a compiled
language makes it slower than C, when performing huge amounts of
computations within an algorithm or program.
First of all: whatever you do, use NumPy for all numerical
On Mar 3, 8:15 pm, Scott David Daniels scott.dani...@acm.org wrote:
Qt: simplest model, well-documented, until very recently not available
on Windows w/o a restrictive license or substantial cost.
As of March 3, Qt is LGPL on all platforms!!!
The problem is PyQt which is still dual
On Mar 5, 11:11 am, Stefano stef...@vulcanos.it wrote:
In the end of all i searched in internet and i've found that applications
( even commercial ) written with gtk are more and more than other written
with wx and qt (not only with python)
From a technical point of view, Qt is the superior
On Mar 27, 7:10 am, jesse jberw...@gmail.com wrote:
I give up. I cannot find my memory leak!
That's the penalty for using the Python C API.
http://www.cython.org
--
http://mail.python.org/mailman/listinfo/python-list
On 3 Sep, 18:52, ToPostMustJoinGroup22 [EMAIL PROTECTED]
wrote:
I'm coming from a .NET, VB, C background.
Any suggestions for someone new to the scene like me?
Welcome! Unfortunately, you probably have a lot of bad habits to
unlearn. Don't use Python like another C, VB or Java. It will cause
1 - 100 of 771 matches
Mail list logo