combine modelformset and inlineformset in django views

2012-08-12 Thread Asif Jamadar
I have two models class A(models.Model): name = models.CharField(50) type = models.CharField(50) class B(models.Model): field1 = ForeignKeyField(A) value = IntegerField() I need to generate both formsets and inline formsets using the

Re: Official reason for omitting inspect.currentcallable() ?

2012-08-12 Thread Terry Reedy
On 8/12/2012 7:06 PM, kj wrote: Is there an *explicitly stated* reason (e.g. in a PEP, or in some python dev list message) for why the inspect module (at least for Python 2.7) 2.7 is over two years old. Things have been added to the inspect module since. So when asking about 'why feature x i

Python Game Programming Challenge (PyWeek) #15 is coming!

2012-08-12 Thread Richard Jones
The 15th Python Game Programming Challenge (PyWeek) is coming. It'll run from the 9th to the 16th of September: http://pyweek.org/ The PyWeek challenge: 1. Invites entrants to write a game in one week from scratch either as an individual or in a team, 2. Is intended to be challenging and fun,

Re: Does anyone have an activate script for portable python?

2012-08-12 Thread alex23
On Aug 12, 9:09 am, Gelonida N wrote: > In Pythons installed with virtualenv there is on windows an activate.bat > script, that can be used to setup the cmd-shell such, that the search > path for python and pythor elated tools (pip / easy_install) is setup > properly. > Do such a scripts also exis

Re: Arithmetic with Boolean values

2012-08-12 Thread Gene Heskett
On Sunday 12 August 2012 20:27:13 Alister did opine: > On Sun, 12 Aug 2012 19:20:26 +0100, Mark Lawrence wrote: > > On 12/08/2012 17:59, Paul Rubin wrote: > >>> which can be simplified to: > >> > >>> for x in range(len(L)//2 + len(L)%2): > >> for x in range(sum(divmod(len(L), 2))): ... > > > > S

Re: save dictionary to a file without brackets.

2012-08-12 Thread alex23
On Aug 10, 7:37 pm, Mark Lawrence wrote: > Well whatever you do *DON'T* mention Cython. I mentioned it just now but > I think I've got away with it. While I'm not against threads straying off topic, you're beginning to come across as a bit of an asshole now. Just let it go. -- http://mail.pytho

Re: ANN: visage (interfaces)

2012-08-12 Thread jwp
On Sunday, July 29, 2012 10:18:23 PM UTC-7, jwp wrote: > What's c.l.py's perspective on managing interfaces and implementations? I pushed another version with support for IID references, so you can refer to implementations in annotations. The ultimate point of this is to give registry queries th

Official reason for omitting inspect.currentcallable() ?

2012-08-12 Thread kj
Is there an *explicitly stated* reason (e.g. in a PEP, or in some python dev list message) for why the inspect module (at least for Python 2.7) does not include anything like a "currentcallable()" function that would *stably*[1] return the currently executing callable object? (It seems unlikely

Re: suggesting a launcher wrapper script for portable python

2012-08-12 Thread Gelonida N
On 08/12/2012 09:52 PM, Mark Lawrence wrote: On 12/08/2012 01:49, Gelonida N wrote: I think it would be great if the official portable python release contained some upport for launching scripts. Perhaps it exists alrady and I just didn't find it? If not,then I wouldn't mind if my script or a

Re: suggesting a launcher wrapper script for portable python

2012-08-12 Thread Gelonida N
Hi Thomas, On 08/12/2012 09:05 PM, Thomas Jollans wrote: On 08/12/2012 02:49 AM, Gelonida N wrote: One minor drawback of my suggested script would be, that a console window pops up for a few seconds when starting a .pyw file. (I'm no expert but) This should be avoidable if you use the Window

Re: in-place exponentiation incongruities

2012-08-12 Thread Terry Reedy
On 8/12/2012 7:55 AM, Giacomo Alzetta wrote: What I mean is: when you implement a new type as a C extension you have to provide special methods through the NumberMethods struct. In this struct both the power and in-place power operations have three arguments. I am not really sure why the latte

Re: Running Python web apps on shared ASO servers?

2012-08-12 Thread Tim Golden
On 12/08/2012 21:52, Gilles wrote: On Sun, 12 Aug 2012 07:56:26 +0200, Dieter Maurer wrote: You should probably read the mentioned forum resources to learn details about the Python support provided by your web site hoster. Yup, but so far, no answer, so I figured someone here might now. Thos

Re: Running Python web apps on shared ASO servers?

2012-08-12 Thread Gilles
On Sun, 12 Aug 2012 07:56:26 +0200, Dieter Maurer wrote: >You should probably read the mentioned forum resources to learn >details about the Python support provided by your web site hoster. Yup, but so far, no answer, so I figured someone here might now. Those articles seem to indicate that CGI

Re: Arithmetic with Boolean values

2012-08-12 Thread Alister
On Sun, 12 Aug 2012 19:20:26 +0100, Mark Lawrence wrote: > On 12/08/2012 17:59, Paul Rubin wrote: >>> which can be simplified to: >>> for x in range(len(L)//2 + len(L)%2): >> >> for x in range(sum(divmod(len(L), 2))): ... >> >> > So who's going to be first in with "and thou shalt not count to 4...

Re: suggesting a launcher wrapper script for portable python

2012-08-12 Thread Mark Lawrence
On 12/08/2012 01:49, Gelonida N wrote: I just started looking at portable Python and was rather surprised, that I didn't find any recommended method in the documentation of how to launch scripts with portable python. Creating py2exe scripts on ones own USB drive seems to be kind of overkill. So

Re: lpod-python

2012-08-12 Thread Agon Hajdari
On Fri, 10 Aug 2012 19:37:16 +0200, Francesco wrote: > I'm trying to use the lpod-python module to programmatically read data > from Open Document files. My problem is: i can't download the module > from its authors' site, > http://download.lpod-project.org/lpod-python/lpod-python-0.9.3.tar.gz. >

Re: suggesting a launcher wrapper script for portable python

2012-08-12 Thread Thomas Jollans
On 08/12/2012 02:49 AM, Gelonida N wrote: > > One minor drawback of my suggested script would be, that a console > window pops up for a few seconds when starting a .pyw file. (I'm no expert but) This should be avoidable if you use the Windows Script Host instead of DOS command scripts to write th

Re: Arithmetic with Boolean values

2012-08-12 Thread Roy Smith
In article , Mark Lawrence wrote: > On 12/08/2012 17:59, Paul Rubin wrote: > >> which can be simplified to: > >> for x in range(len(L)//2 + len(L)%2): > > > > for x in range(sum(divmod(len(L), 2))): ... > > > > So who's going to be first in with "and thou shalt not count to 4..."? You, apparen

Re: Arithmetic with Boolean values

2012-08-12 Thread Mark Lawrence
On 12/08/2012 17:59, Paul Rubin wrote: which can be simplified to: for x in range(len(L)//2 + len(L)%2): for x in range(sum(divmod(len(L), 2))): ... So who's going to be first in with "and thou shalt not count to 4..."? -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/

Re: Arithmetic with Boolean values

2012-08-12 Thread Bernd Nawothnig
On 2012-08-12, Paul Rubin wrote: >> which can be simplified to: >> for x in range(len(L)//2 + len(L)%2): > > for x in range(sum(divmod(len(L), 2))): ... nice solution. Bernd -- "Die Antisemiten vergeben es den Juden nicht, dass die Juden Geist haben - und Geld." [Friedrich Nietzsche] -- http

Re: Arithmetic with Boolean values

2012-08-12 Thread Paul Rubin
> which can be simplified to: > for x in range(len(L)//2 + len(L)%2): for x in range(sum(divmod(len(L), 2))): ... -- http://mail.python.org/mailman/listinfo/python-list

[RELEASED] Python 3.3.0 beta 2

2012-08-12 Thread Georg Brandl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team, I'm happy to announce the second beta release of Python 3.3.0 -- a little later than originally scheduled, but much better for it. This is a preview release, and its use is not recommended in production settin

Re: save dictionary to a file without brackets.

2012-08-12 Thread 88888 Dihedral
Steven D'Aprano於 2012年8月11日星期六UTC+8下午7時26分37秒寫道: > On Fri, 10 Aug 2012 08:53:43 +1000, Chris Angelico wrote: > > > > > On Fri, Aug 10, 2012 at 8:26 AM, Dave Angel wrote: > > >> On 08/09/2012 06:03 PM, Andrew Cooper wrote: > > >>> O(n) for all other entries in the dict which suffer a hash coll

Re: in-place exponentiation incongruities

2012-08-12 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 13:03:08 UTC+2, Steven D'Aprano ha scritto: > On Sun, 12 Aug 2012 00:14:27 -0700, Giacomo Alzetta wrote: > > > > > From The Number Protocol(http://docs.python.org/c-api/number.html). The > > > full text is: > > > > > > PyObject* PyNumber_InPlacePower(PyObjec

Re: Arithmetic with Boolean values

2012-08-12 Thread Roy Smith
In article <502791ea$0$29978$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > for x in (0,) if len(L)%2 else (0, 1): > ... > > which is even more explicit and simpler to read even though it is longer. Ugh. do_stuff() if len(L) % 2 == 0: do_stuff() # reprocess even-length

Re: Arithmetic with Boolean values

2012-08-12 Thread Steven D'Aprano
On Sat, 11 Aug 2012 17:54:40 -0700, Paul Rubin wrote: > John Ladasky writes: [...] >> If the length of the list L is odd, I want to process it once. If >> len(L) is even, I want to process it twice >> for x in range(1 + not(len(L) % 2)): > > If you really have to do something like that, I

Re: in-place exponentiation incongruities

2012-08-12 Thread Steven D'Aprano
On Sun, 12 Aug 2012 00:14:27 -0700, Giacomo Alzetta wrote: > From The Number Protocol(http://docs.python.org/c-api/number.html). The > full text is: > > PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject > *o3) > Return value: New reference. > > **See the built-in funct

Re: in-place exponentiation incongruities

2012-08-12 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 06:28:10 UTC+2, Steven D'Aprano ha scritto: > On Sat, 11 Aug 2012 09:54:56 -0700, Giacomo Alzetta wrote: > > > > > I've noticed some incongruities regarding in-place exponentiation. > > > > > > On the C side nb_inplace_power is a ternary function, like nb_pow