>answerDict=dict(map(lambda x: (str(x[1]),x[0]),map(lambda x: \
>> x.values(),Answer.objects.filter(fk_questionSet=1). \
>> filter(fk_question=1).values('widgetAnswer').order_by(). \
>> annotate(widgetCount=Count('widgetAnswer')
>>
>>
> The first time there
>
>>>If you really want to bend your brain in Lisp (Scheme) try
The Little Schemer and its follow up the Seasoned Schemer
>>
>
>Is that linked to the Little Lisper somehow?
>Yes, its the second edition ported to Scheme.
In fact I used the Little Lisper then moved to the Seasoned Schemer.
There
On Fri, Jun 4, 2010 at 8:24 PM, Alan Gauld wrote:
> "Hugo Arts" wrote
>
>
> [1] http://mitpress.mit.edu/sicp/
>> [2]
>> http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
>>
>>
> And I'd add the superb How to Design Programs:
>
> http://www.htdp.org/
>
> It teaches Scheme pr
"Hugo Arts" wrote
[1] http://mitpress.mit.edu/sicp/
[2]
http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/
And I'd add the superb How to Design Programs:
http://www.htdp.org/
It teaches Scheme programming using a recipe approach
that creates a standard stricture for
On Fri, 4 Jun 2010 12:26:20 -0400
Tino Dai wrote:
> Also could you give me some instances
> where a generator
> would be used in a real situation? I have already read the stuff on
> doc.python.org about
> generators.
Sure, generally speaking in the programming world, documentation misses the
fi
On Fri, Jun 4, 2010 at 6:26 PM, Tino Dai wrote:
>
> LOL, it's actually on the list of things to do. And hear that one will become
> a
> better programmer once they learn LISP.
>
I most certainly did. There are very few languages as conceptually
pure as this one. If you ever get it on the top of
Hugo Arts wrote:
On Fri, Jun 4, 2010 at 1:23 PM, Dave Angel wrote:
I'd prefer the form:
flag =ot not (someValue or another)
That's a construct you might commonly find in languages like C, but I
don't think it's very pythonic. If you want to convert your result to
a bool, be explici
On Fri, Jun 4, 2010 at 10:02 PM, ALAN GAULD wrote:
>
> No, I'm simply offering a reason to use if/else in the general sense.
>
> In practice, for this specific case, I'd go with the bool(expr) form.
>
Ah, then it seems we are in agreement. Sorry for the misunderstanding
__
> Are you arguing that the if/else form is better than simply casting
> to bool because it is more explicit?
No, I'm simply offering a reason to use if/else in the general sense.
In practice, for this specific case, I'd go with the bool(expr) form.
Alan Gauld
Author of the Learn To Program we
On 4 jun 2010, at 21:02, ALAN GAULD wrote:
Eek! no I'd just cast to a bool:
flag = bool(someValue or another)
but the if/else form has the Pythonic virtue of explicitness.
Are you arguing that the if/else form is better than simply casting to bool
because it is more explicit? You could ha
> > flag = True if (someValue or another) else False
> >
> I'd prefer the form:
>
>flag = not not (someValue or another)
Eek! no I'd just cast to a bool:
flag = bool(someValue or another)
but the if/else form has the Pythonic virtue of explicitness.
Alan G.
__
On 6/4/2010 5:46 AM Tino Dai said...
I'm at a point where I can do most things in Python (maybe) ,
now I'm looking to do them succinctly and elegantly. For instance, I
had about 10 - 15 lines of code to do this before with a bunch of
loops and if blocks, I distilled the product down to t
> I have a distinct feeling that you would simply love a language like lisp.
LOL, it's actually on the list of things to do. And hear that one will become a
better programmer once they learn LISP.
> The code is succinct, and it may very well be called elegant in some
> sense of the word. I might
On Fri, Jun 4, 2010 at 2:46 PM, Tino Dai wrote:
>
> I'm at a point where I can do most things in Python (maybe) ,
> now I'm looking to do them succinctly and elegantly. For instance, I
> had about 10 - 15 lines of code to do this before with a bunch of
> loops and if blocks, I distilled th
On Fri, Jun 4, 2010 at 1:23 PM, Dave Angel wrote:
>
> I'd prefer the form:
>
> flag = not not (someValue or another)
>
That's a construct you might commonly find in languages like C, but I
don't think it's very pythonic. If you want to convert your result to
a bool, be explicit about it:
flag =
> That is technically correct, you could do that. That's a good example of
> the syntax of the `if` expression, but it's a bad example of where to
> use it:
>
> (1) it only works in Python 2.5 or better; and
>
> (2) experienced Python programmers will laugh at you :)
>
> with all due respect to Ala
Alan Gauld wrote:
flag = True if (smoeValue or another) else False
is different to
flag = someValue or another
Which was why I thought it worth pointing out that the if/else
could be used.
I'd prefer the form:
flag = not not (someValue or another)
if I needed real True or False resul
"Steven D'Aprano" wrote
isThumbnail = True if size == "thumbnail" else False
That is technically correct, you could do that. That's a good
example of
the syntax of the `if` expression, but it's a bad example of where
to
use it:
In the sense that an equality test will always give a real
b
On Fri, 4 Jun 2010 03:10:41 am Alan Gauld wrote:
> "Tino Dai" wrote
>
> >Is there a way to express this:
> >isThumbnail = False
> >if size == "thumbnail":
> >isThumbnail = True
> >
> > like this:
> > [ isThumbnail = True if size == "thumbnail" isThumbnail =
> > False ]
On 6/3/2010 8:50 AM Tino Dai said...
Hi All,
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail = False ]
and the scoping extending to one lev
On Thu, 3 Jun 2010 11:50:42 -0400
Tino Dai wrote:
> Hi All,
>
> Is there a way to express this:
> isThumbnail = False
> if size == "thumbnail":
> isThumbnail = True
>
> like this:
> [ isThumbnail = True if size == "thumbnail" isThumbnail = False ]
> and the sc
"Tino Dai" wrote
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail =
False ]
Bob showed one way, you could also do:
isThumbnail = True if size == "thumbna
On 6/3/2010 11:50 AM, Tino Dai wrote:
Hi All,
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
How I do that is:
isThumbnail = size == "thumbnail":
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail
Hi All,
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail = False ]
and the scoping extending to one level above without resorting to the
global keywo
24 matches
Mail list logo