[Baypiggies] A mini-decorator workshop
akleider at sonic.net
akleider at sonic.net
Sat Jul 24 04:54:33 CEST 2010
May I suggest such a talk might be held at next month's meeting. Jim
hasn't found a speaker anyway (is that still true?) and there seemed to be
a lot of general interest even though it is a 'newbie' topic. It might not
appeal to the pundits but perhaps there are enough who would be interested
to justify its being the main talk.
..just a suggestion..
> My work schedule is horrible for stuff like this. ( Currently 3pm-12am,
> but next week going to 1-9pm). In order for me to attend there needs to
> be wireless access (this is why I wasn't there last night... Symantec is
> awesome for hosting, but loses points for no wifi). Regardless I would
> love to attend this workshop.
> On 07/23/2010 04:52 PM, Glen Jarvis wrote:
>> I really had a good time at the talk last night. There were some
>> *good* questions and lots of interests -- that's always fun.
>> I am *very* interested in helping everyone get past this first hurdle.
>> If there is demand, I will hold a 2-3 hour FREE hands-on workshop over
>> the same material (assuming we can all agree on a date, time and
>> Please be aware that the scope of what I'm talking about is still
>> within what was presented. Therefore, we won't be going into, for
>> example, the introspection that is used in attrs. It's easy enough,
>> but not the purpose of the talk/workshop. We won't talk about class
>> decorators, etc.
>> This first level idea is "How do I use decorators," -- not how do I
>> write my own or even how these decorators work internally (although we
>> can certainly dip our toes in at the very end of the workshop). We can
>> also expand on how to use decorators before the pie syntax was
>> included in Python - as that's still in the scope of *using* decorators.
>> If we have questions outside this scope, I will plead ignorance (which
>> may actually be true; but maybe not) and move to the next subject.
>> Now that I've firmly set your expectation on scope, if there's
>> interest in doing this, we can put together a small get together one
>> evening after work. Because I already have materials prepared, this
>> won't take any lead-time to set-up.
>> Note that this will give us more time. So, I can ask you to, for
>> * Write a function that takes two arguments. The first argument should
>> only be an integer. But, the second argument can either be an integer
>> or a float. Enforce this through assertions. Code should be PEP-8
>> * The above, but pick one of the four decorators we discussed to do
>> the same thing, instead. We can then have a discussion on why a person
>> would choose the first (above) or this approach to do the same task.
>> (Or some may argue that we are pre-optimizing and we shouldn't make
>> such restrictions on functions unless absolutely necessary (and I
>> would agree).
>> * (Other similar exercises with some of the other three decorators we
>> have distributed and discussed)
>> * Write a function that takes as its arguments two functions (we'll
>> call f1, and f2). Within the body of the function, call f1 and f2.
>> Demonstrate how we see pass functions around like any object
>> * Create a function that wraps another function
>> * etc.
>> If you can already do all of the above, you'd probably be bored silly
>> and shouldn't attend this workshop. We'll advance to deeper levels
>> over time -- just not at this meeting.
>> The format would be in two portions: An introduction (same spiel as
>> last night), and self-paced assignments/workshop. We would take more
>> time to work on the example exercises. And, you would work on the
>> examples while while we wait for questions to help you when you get
>> Because this is self paced (after my initial spiel), people will
>> finish at different times. I can imagine we'll finish in 3 hours or
>> less -- some much quicker than others.
>> Let me know if you're interested and I'll give you a 10% discount on
>> the already FREE workshop ;) This offer expires 1 week (i.e., if no
>> one responds by then, I'm moving on to something else)...
>> Whatever you can do or imagine, begin it;
>> boldness has beauty, magic, and power in it.
>> -- Goethe
>> Baypiggies mailing list
>> Baypiggies at python.org
>> To change your subscription options or unsubscribe:
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
More information about the Baypiggies