These are chat archives for ipython/ipython

20th
Jul 2015
Brian E. Granger
@ellisonbg
Jul 20 2015 16:01
Walking to my office now
Sylvain Corlay
@SylvainCorlay
Jul 20 2015 18:39
updated the PR on read-only attributes
ipython/traitlets#44
I will add tests and all if you are fine with this.
Nicholas Bollweg
@bollwyvl
Jul 20 2015 19:28
ooh, looks like gist now renders ipynb. don't think it did this morning
Min RK
@minrk
Jul 20 2015 19:30
@bollwyvl lucky! It still doesn't for me.
Nicholas Bollweg
@bollwyvl
Jul 20 2015 19:41
hah
ah, the A/B-go-rond
Damian Avila
@damianavila
Jul 20 2015 20:06
yep... working for me too...
svurens
@svurens
Jul 20 2015 21:48
@minrk @jdfreder so @alope107 and I got new apple laptops, how do we macintosh?
like that ^
alope107
@alope107
Jul 20 2015 22:05
ah, thank you. That clears it up
Min RK
@minrk
Jul 20 2015 22:09
New to OS X?
svurens
@svurens
Jul 20 2015 22:09
yeah
Min RK
@minrk
Jul 20 2015 22:09
Step 1: Xcode: xcode-select --install
Step 2: Homebrew
Step 3: Python, where you have a choice - either brew install python3 or conda
For code, use whatever you like - vim, emacs, atom, sublime, textmate, etc. I use textmate, other folks are using atom and sublime.
If you use atom, the first thing to do is Settings > Packages > Whitespace > Disable
svurens
@svurens
Jul 20 2015 22:13
got sublime
got git with brew
Jonathan Frederic
@jdfreder
Jul 20 2015 22:13
blob
alope107
@alope107
Jul 20 2015 22:14
thanks for the help!
Jason Grout
@jasongrout
Jul 20 2015 22:22
relevant xkcd: https://xkcd.com/961/
Ryan Morshead
@rmorshea
Jul 20 2015 22:26
@SylvainCorlay @jasongrout , I've run into an instance refactoring matplotlib code where it's relevant to have the capacity to bypass __get__ in a new TraitType. To keep some symmetry I did something similar with __set__ as well, and @ellisonbg thought you guys should weigh in on this. There's two principles behind what I wrote, the first being that there are a large number of places in the matplotlib code base where transformations are performed on "get" through properties rather than on "set". However, the second, which is probably more controversial is that there may be some cases where you want to transform a value prior to validation rather than validating, transforming, and revalidating. Here's what I wrote:
class TraitTypeGetterSetter(TraitType):

    def __get__(self, obj, cls=None):
        if hasattr(obj, '_'+self.name+'_getter'):
            meth = getattr(obj, '_'+self.name+'_getter'):
            return meth(self, cls)
        else:
            super(TraitType,self).__get__(obj,cls)

    def __set__(self, obj, value):
        if hasattr(obj, '_'+self.name+'_setter'):
            meth = getattr(obj, '_'+self.name+'_setter'):
            value = meth(self, value)
        super(TraitType,self).__set__(obj, value)
Sylvain Corlay
@SylvainCorlay
Jul 20 2015 22:34
what do you mean by "transformation"?
you may validate value after coercion
at the custom validation stage.
is it what you mean?
Ryan Morshead
@rmorshea
Jul 20 2015 22:37
e.g.
@ property
def transform(self):
        return self.dpi_transform + self.offset_transform
Sylvain Corlay
@SylvainCorlay
Jul 20 2015 22:37
oh, you don't mean transformation of a trait value ok. it is a matplotlib thing
Ryan Morshead
@rmorshea
Jul 20 2015 22:38
also e.g.
@transform.setter
def transform(self, value):
    pass
Sylvain Corlay
@SylvainCorlay
Jul 20 2015 22:45
what exactly is a transformation. Is it some kind of handler that transform some matplotlib properties when it is set?
Ryan Morshead
@rmorshea
Jul 20 2015 22:47
a transformation is a matplotlib object which holds information about how an object's position should transformed on render I believe.
the _name_setter use case is valuable if a TraitType might be expected to receive instances of three different classes all of which might be converted to versions which would be capable of passing validation by Int.
Sylvain Corlay
@SylvainCorlay
Jul 20 2015 23:01
I 've got to run, I will look at the PR in matplotlib to get a better picture of the problem
Ryan Morshead
@rmorshea
Jul 20 2015 23:23
I'm going through things with a different workflow right now so I'll be posting things to a different branch. I'll tag you and post it once it's ready.