On 10/24/2010 07:55 PM, mukkera harsha wrote:
On, doing now - startup I want the program to return in terms of days. How ?
>>> import datetime
>>> now = datetime.datetime.now()
>>> after_few_seconds = datetime.datetime.now()
>>> after_few_seconds - now
datetime.timedelta(0, 14, 256614)
>>> (aft
On 10/21/2010 08:09 PM, Brendan wrote:
Two modules:
x.py:
class x(object):
pass
y.py:
from x import x
class y(x):
pass
Now from the python command line:
import y
dir(y)
['__builtins__', '__doc__', '__file__', '__name__', '__package__',
'x', 'y']
I do not understand why class 'x' sh
On 10/16/2010 06:04 PM, Kruptein wrote:
Hey, I've written a small "IDE". It is written in python using the
python toolkit and
offers an advanced text-editor, file-manager, ftp-client, sql-
client(in development) and more towards the future.
You definitely want to have a look at PEP8.
--
http:/
On 10/13/2010 11:26 PM, Seebs wrote:
stderr.write(
"WARNING:"
" Pants on fire\n")
Hmm. So I just indent stuff inside the ()s or whatever? I can work with
that.
I think common is
stderr.write("WARNING: ",
"Pants on fire")
or
stderr.write(
On 10/13/2010 06:48 PM, Seebs wrote:
Is it safe for me to assume that all my files will have been flushed and
closed? I'd normally assume this, but I seem to recall that not every
language makes those guarantees.
Not really. Files will be closed when the garbage collector collects the
file ob
On 10/12/2010 10:48 PM, Pratik Khemka wrote:
Likewise I want to read the number after the '#' and store it in num. The
problem is that the number can be a 1/2/3/4 digit number. So is there a way in
which I can define num so that it contains the number after '#' irrespective of
how many digits
On 10/12/2010 09:14 PM, Seebs wrote:
http://github.com/wrpseudo/pseudo/blob/master/makewrappers
Just a few pointers, looks quite good to me for a newbie :)
* Less action in __init__.
* Use `open` instead of `file` to open a file
* Have a look at context managers for file handling (avoids doing
On 10/08/2010 05:23 PM, Carolyn MacLeod wrote:
"How do I pass an integer by reference to a C function?"
That's impossible in pure Python. The only thing I can think of is a
wrapper in C.
--
http://mail.python.org/mailman/listinfo/python-list
On 10/08/2010 03:27 PM, kj wrote:
I tried to understand this by looking at the C source but I gave
up after 10 fruitless minutes. (This has been invariably the
outcome of all my attempts at finding my way through the Python C
source.)
It's not you. CPython's code is ... [censored]
Anyway, you
On 10/08/2010 02:23 AM, kj wrote:
I imagine that frozenset is better than sorted(tuple(...)) here,
but it's not obvious to me why.
dicts are unsorted. That means their item-order is undefined. So are sets.
If you want a hash that is independent from the order of items, you
could ensure the it
On 10/06/2010 02:01 PM, Antoine Pitrou wrote:
It shouldn't. Are you sure you're calling PyType_Ready in the module
initialization routine?
Yeah. The problem was that the type struct was declared 'static' in
another module so the changes `PyType_Ready` made to the struct weren't
applied correc
On 10/05/2010 11:11 PM, hid...@gmail.com wrote:
Hello, how i can save a binary file, i read in the manual in the IO area
but doesn' t show how to save it.
Here is the code what i am using:
s = open('/home/hidura/test.jpeg', 'wb')
s.write(str.encode(formFields[5]))
s.close()
So where's the probl
On 10/04/2010 11:41 PM, Antoine Pitrou wrote:
Well, it should work, but you have to call PyType_Ready() to fill in
the NULL fields with default values (for those where it's necessary).
Does it solve it for you?
Yes, thank you! Although I do not understand which fields I have to
provide. I want
On 10/04/2010 10:46 AM, Jonas H. wrote:
On 10/03/2010 11:52 PM, Antoine Pitrou wrote:
You probably have a problem in your tp_dealloc implementation.
`tp_dealloc` is NULL...
Alright, `tp_dealloc` must not be NULL because it's called by
`_Py_Dealloc`. The C-API tutorial is quite conf
On 10/03/2010 11:52 PM, Antoine Pitrou wrote:
You probably have a problem in your tp_dealloc implementation.
`tp_dealloc` is NULL...
--
http://mail.python.org/mailman/listinfo/python-list
On 10/03/2010 03:47 PM, Antoine Pitrou wrote:
You shouldn't call PyObject_FREE yourself, but instead rely on
Py_DECREF to deallocate it if the reference count drops to zero.
So, instead of commenting out Py_DECREF and keeping PyObject_FREE, I'd
recommend doing the reverse. That way, if a referenc
On 10/03/2010 01:16 AM, Antoine Pitrou wrote:
You should check that you aren't doing anything wrong
with "env" and "start_response" (like deallocate them forcefully).
I commented out the `Py_DECREF(start_response)` after the `app` call and
the crash was gone. `start_response` is created via `P
Hello list,
I have a really weird reference problem with `sys.exc_info`, and, if I'm
right, function frames.
The software in question is bjoern, a WSGI web server written in C,
which you can find at http://github.com/jonashaag/bjoern.
This WSGI application:
def app(env, start_response):
Hi there,
I'm currently diving into Python C programming and I have a problem with
`PyDict_New`.
My application receives a SIGABRT from malloc every time I execute
`PyDict_New`. malloc throws the following error:
malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr)
(((char *) &
19 matches
Mail list logo