Changes between Version 5 and Version 6 of ShortcutSyntaxIdeas


Ignore:
Timestamp:
09/21/05 12:08:46 (9 years ago)
Author:
brantley (deadwisdom@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ShortcutSyntaxIdeas

    v5 v6  
    3737}}}
    3838
     39
    3940''I think this is brilliant, but with a couple of hangups. Firstly, I think returning a single dictionary would make more sense (in most cases) than yielding - although I have no preblem with yield being supported as an alternative. Secondly, why yield single key dictionaries instead of tuple pairs?'' - SimonWillison
     41
     42{{{
     43#!python
     44from django.views.decorators.shortcuts import page
     45
     46# also:
     47
     48@page('primes/index', title='Page Title')      # @page(template_name, **default_context)
     49def prime_index(request):
     50    primes = [2,3,5,7]
     51    header = "The first 4 primes"
     52    yield locals()
     53}}}
     54
     55''I was merely trying to show that you can yield sequentially, and it would add to a single dict.  You could just as easily yield a single dictionary.  But I've found that sometimes it is nice to be able to yield items at different parts of the function.  Also, one can "yield locals()", which can be fun.  I've added it above'' - Brantley
    4056
    4157== Idea 2: Class ==
Back to Top