IMHO, parsing the string is just a matter of administrative logic and
should not be bothered with when focussing on the business logic (which, in
this case, is recreating the hierarchy).
Sure JSON, YAML, and XML(ugly) are a few options to choose from for parsing
the string. In the end, It is just
On second thought, we would NOT like to parse escape characters as maya
would complain later:
for nodeName, currIndent in ((line.strip(),
len(line) - len(line.lstrip()))
for line in hierarchy.split("\n")
Thanks Alok, that's just what I was looking for.
I was just about to mention that about the escape characters, a bare
`strip()` works to our advantage here.
Use of bisect is interesting, I'll have to dig deeper into that.
--
You received this message because you are subscribed to the Google Gro
Ok, Alok, I had a closer look at your example and the bisect module in
Python.
In my example, a dict replaces bisect. The dict is limited, in that once a
parent at the same level as an above parent appears, the above parent
vanishes from consideration. But in this case, maybe that works to our
Hi Marcus,
My objective was simple, parenting is the main focus and it should be done
once and only once for each node in the hierarchy. To achieve this, during
each iteration the node should have knowledge about his parent just by
knowing its position (indent).
I did not want complex processing
> but then you should do this lookup only once for each node and not
iterate through each key and then deep inside it until some condition is
reached. To me, that is a bit complex.
Ah, yes that is true. I did not think of that. Thanks for pointing that out.
As someone who isn't terribly familiar
> How does bisect achieve this if not by traversing each node in turn and
returning the first found, like how the dict is being used currently?
In all fairness, there is no way, this can be achieved without some sort of
iteration. Bisect is efficient because it implements the binary search
algorit
It can be achieved without iteration if you solve the original problem in
another way.
If the problem originally is:
I’m putting together a minor helper function for establishing a transform
hierarchy within Maya but am not yet satisfied with the implementation.
Then I might suggest something li
Hi Ian,
Although your approach is so valid, I was working under the following
constraints, most of which were assumptions:
1. Marcus originally presented a single function with a need to
reimplement it to achieve a few specific goals as he mentioned.
2. I wanted to keep the signature of the funct
Thanks Ian!
Some notes.
- The implementation is up for grabs, but I'd like to keep the interface of
the function; that is, passing a single string with indentation for
hierarchy.
- Performance is not important here, because (1) the function is only being
used in example code, where the call itsel
Ah ok, just saw Marcus's answer, so most of my assumptions were correct. I
would still say, there are many ways to achieve the same thing in
programming. With the kind of flexibility, that python provides, the 'many
ways' becomes 'so many ways'.
Coming back to some of the points that Ian raised:
On Sat, Sep 17, 2016 at 5:27 AM Alok Gandhi
wrote:
>
> Coming back to some of the points that Ian raised:
> > Readability is a perfectly valid goal to seek but I
> find maintainability is often overlooked.
>
> IMHO more readable code is more maintainable. Readability goes hand in
> hand with
Is performance something you are concerned with for this process?
Yury
On Sep 16, 2016 6:16 PM, "Justin Israel" wrote:
>
>
> On Sat, Sep 17, 2016 at 5:27 AM Alok Gandhi
> wrote:
>
>>
>> Coming back to some of the points that Ian raised:
>> > Readability is a perfectly valid goal to seek but
On Sat, 17 Sep 2016, 1:09 PM yury nedelin wrote:
> Is performance something you are concerned with for this process?
> Yury
>
Marcus had said it was not a concern. I was just sharing some interesting
info on the topic of readability and maintainability
> On Sep 16, 2016 6:16 PM, "Justin Israel"
@Justin: I agree with readability trumping performance, and almost at all
times, I follow almost the same tenets. However, in our trade, performance
is ever more critical and is becoming important every single day. The
entertainment industry is one of the major stakeholders when it comes to
demand
On Sat, Sep 17, 2016 at 5:34 PM Alok Gandhi
wrote:
> @Justin: I agree with readability trumping performance, and almost at all
> times, I follow almost the same tenets. However, in our trade, performance
> is ever more critical and is becoming important every single day. The
> entertainment indus
>
> Also I would like to throw my 2 cents in as someone that develops not as
> one that writes scripts and tools on a per-show basis to get shots finaled,
> but as one that works on longer term projects to serve the ongoing
> pipeline. The advise from that conference might be more applicable to
> s
On Sat, 17 Sep 2016, 6:12 PM Alok Gandhi wrote:
> Also I would like to throw my 2 cents in as someone that develops not as
>> one that writes scripts and tools on a per-show basis to get shots finaled,
>> but as one that works on longer term projects to serve the ongoing
>> pipeline. The advise f
18 matches
Mail list logo