Description:
The Python computer language.
|
|
|
Common LISP-style closures with Python
|
| |
In Python textbooks that I have read, it is usually not mentioned that
we can very easily program Common LISP-style closures with Python. It
is done as follows:
------------------------------ -------
...
def f1():
n = 0
def f2():
nonlocal n
n += 1
return n... more »
|
|
Help writelines
|
| |
Hi,
You have to iterate.
Either with
for u in users:
fob.write( u + '\n' )
or with a lambda function.
always a good call: [link]
greets,
M.
...
|
|
Script randomly exits for seemingly no reason with strange traceback
|
| |
It's a rare occurrence, but sometimes my script will terminate and I get
this:
Traceback (most recent call last):
File "C:\path\to\script\script.py", line 992, in <module>
That's it. And the line number is always the last line of the file
(which in my case is a blank line). I have not seen this on Linux (where... more »
|
|
[no subject]
|
| |
...
You might prefer to ask such questions on the tutor mailing list instead:
[link]
Cheers,
Chris
|
|
Linker errors when attempting to install PyCrypto
|
| |
I'm getting linker errors when trying to install PyCrypto on Windows:
C:\libraries\MinGW\bin\gcc.exe -mno-cygwin -shared -s
build\temp.win-amd64-2.7\Relea se\src\winrand.o
build\temp.win-amd64-2.7\Relea se\src\winrandom.def -LC:\Python27\libs
-LC:\Python27\PCbuild\amd64 -lws2_32 -ladvapi32 -lpython27 -lmsvcr90... more »
|
|
Help with COM_error
|
| |
I am not a programmer, but this past week I have had a crash course in
python scripting am have been rather impressed with myself for having
written a fairly complicated script that among many other processes
reads a database table via SearchCursor, populates a word template via
Bookmarks, then saves the document out as a PDF.... more »
|
|
multiple constructor __init__
|
| |
...
I believe you can approximate that using a keyword-only argument
without a default value:
...class QObject(object):
def __init__(self, param1=some_default, *, parent):
# …
obj1 = QObject(parent=daddy)
obj2 = QObject(arg1, parent=daddy)
obj3 = QObject(daddy) # ERROR
obj4 = QObject(arg1, daddy) # ERROR... more »
|
|
|