[omaha] February meeting 2014

Steve Young wereapwhatwesow at gmail.com
Wed Feb 19 21:12:59 CET 2014


Since Lea was the only one showing interest this month, and no one could
entice Joe to abandon CERT, let's wait until next month.

BUT to help make it happen - does anyone have topics to share (Wes?) or
want to talk about?  Lets build some enthusiasm!

Steve


On Tue, Feb 18, 2014 at 9:54 PM, Jeff Hinrichs - DM&T <jeffh at dundeemt.com>wrote:

> On Tue, Feb 18, 2014 at 7:20 PM, Wes Turner <wes.turner at gmail.com> wrote:
>
> > re: Dict2Obj
> >
> > * http://docs.python.org/2/library/userdict.html
> > *
> >
> http://docs.python.org/2/library/collections.html#collections.MappingView
> > *
> >
> http://docs.python.org/3/library/collections.abc.html#collections.abc.MappingView
> >
> > While changing the implementation of `__getattribute__` seems
> > convenient at first, valid attribute identifiers are [a-zA-Z0-9_]+;
> > so, obviously if there are properties that contain punctuation other
> > than underscores, those properties will not be accessible.
> >
> > * http://docs.python.org/2/reference/lexical_analysis.html#identifiers
>
> True, but when you are working with key/value dicts, most would not run
> into this problem and also, this was suggested as a quickie for simplifying
> access.  I wouldn't, nor would I suggest just throwing this code into
> production without some thought.  For instance, eval is helpful sometimes,
> but I would avoid it like the plague in production.  The use case would be
> along the lines of something looser than a proper class and more flexible
> than a named tuple.
>
>
> >
> > `__slots__` may or may not be a helpful optimization for this case:
> >
> > * http://docs.python.org/2/reference/datamodel.html#__slots__
> >
> >
>
> > On 2/18/14, Jeff Hinrichs - DM&T <jeffh at dundeemt.com> wrote:
> > > Crazy busy time of the year, so I won't be able to attend.  But I offer
> > > this snippet to take a dict and return a dot accessible object from it.
> > >
> >
> http://www.blog.pythonlibrary.org/2014/02/14/python-101-how-to-change-a-dict-into-a-class/
> > >
> > >
> > > class Dict2Obj(object):
> > >     """
> > >     Turns a dictionary into a class
> > >     """
> > >
> > >
> > #----------------------------------------------------------------------
> > >     def __init__(self, dictionary):
> > >         """Constructor"""
> > >         for key in dictionary:
> > >             setattr(self, key, dictionary[key])
> > >
> > >
> > #----------------------------------------------------------------------
> > >     def __repr__(self):
> > >         """"""
> > >         attrs = str([x for x in dir(self) if "__" not in x])
> > >
> > >         return "<Dict2Obj: %s>" % attrs
> > >
> >
>  #----------------------------------------------------------------------if
> > > __name__ == "__main__":
> > >     ball_dict = {"color":"blue",
> > >                  "size":"8 inches",
> > >                  "material":"rubber"}
> > >     ball = Dict2Obj(ball_dict)
> > >
> > >
> > > Not needed normally, but once in a while, it's just the ticket.
> > >
> > >
> > > On Mon, Feb 17, 2014 at 1:35 PM, Jay Hannah <jay at jays.net> wrote:
> > >
> > >> On Feb 17, 2014, at 1:25 PM, Steve Young <wereapwhatwesow at gmail.com>
> > >> wrote:
> > >> > This is a sad day for Omaha Python... We are less interesting than a
> > >> > CERT
> > >> > meeting.  I will buy a round if someone comes up with
> > >> > topic/idea/location
> > >> > for this month's meeting that will entice Joe to change his mind!
> > >>
> > >> OMG!Code needs presenter(s) for March 25 7pm. Would anyone be willing
> > >> present whatever Python stuff they're excited about?
> > >>
> > >>    http://omacode.org
> > >>
> > >> Thanks,
> > >>
> > >> j
> > >>
> > >>
> > >>
> > >>
> > >> _______________________________________________
> > >> Omaha Python Users Group mailing list
> > >> Omaha at python.org
> > >> https://mail.python.org/mailman/listinfo/omaha
> > >> http://www.OmahaPython.org
> > >>
> > >
> > >
> > >
> > > --
> > > Best,
> > >
> > > Jeff Hinrichs
> > > 402.218.1473
> > > _______________________________________________
> > > Omaha Python Users Group mailing list
> > > Omaha at python.org
> > > https://mail.python.org/mailman/listinfo/omaha
> > > http://www.OmahaPython.org
> > >
> >
> >
> > --
> > --
> > Wes Turner
> > _______________________________________________
> > Omaha Python Users Group mailing list
> > Omaha at python.org
> > https://mail.python.org/mailman/listinfo/omaha
> > http://www.OmahaPython.org
> >
>
>
>
> --
> Best,
>
> Jeff Hinrichs
> 402.218.1473
> _______________________________________________
> Omaha Python Users Group mailing list
> Omaha at python.org
> https://mail.python.org/mailman/listinfo/omaha
> http://www.OmahaPython.org
>


More information about the Omaha mailing list