potiuk commented on PR #24425:
URL: https://github.com/apache/airflow/pull/24425#issuecomment-1155014920

   > If we talk about cli `airflow providers` is it mean that in anyway if we 
call command it would order exactly once in any case? So move sorts in cli part 
doesn't affect anything
   
   It's also for all other cases (like API) - it's just "preventive sorting" - 
if you use it later, it will be sorted. I just saw too many cases were people 
did not care when they implemented it in the "human-facing" context. Many 
people don't think empathetically about the users. 
   
   Actually this was implemented here precisely because I saw a bunch of CLI 
commands that did not do sorting at all and the output changed randomly as you 
added more connections. and I often struggled with the output of cli and APIs. 
   
   So sorting everything upfront is protection against programmers who use the 
output wtthout thinking about the users :). It happens more often than you 
think. It did happen in Airlfow.
   
   > Oh it some kind of "Holy War. Just personal thoughts since preserve dict 
keys orders as part of the language standard in the most cases there is no 
reason explicit use OrderedDict.
   
   Not realy "war" (and I am not string about it :D ) - but I believe that when 
you write code, you should optimize for reading, not writing. While you can 
produce less code by removing Ordered Dict (and technically you can do it and 
effect of it is the same), sometimes writing more explicit code expressing the 
intention is better. 
   
   For example we would never have this discussion here - if it was not written 
this way, and @uranusjr  figured correctly the intent from the code without 
knowing it upfront. If you don't express the intent, then you could see the 
sorting order here are "accidental", but it was actually intended and for a 
good reason. 
   
   It could be a comment, why it is done this way of course, but too many 
comments are also not good.
   
   Also personal comment :). Don't intend to start tabs vs. spaces war here, 
just wanted to explain the line of thoughts I actually had when implementing it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to