[Yum] another Oooops in archwork.py

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



                Hi!

=====
 def bestarch(archlist):
-    currentarch = 'garbage'
-    for arch in archlist:
-        if currentarch == None:
-            currentarch = betterarch('garbage', arch)
-        else:
-            currentarch = betterarch(currentarch, arch)
-    return currentarch
+    # rewrite this with reduce()
+    _cur_arch = archlist[0]
+    for arch in archlist[1:]:
+        _cur_arch = betterarch(_cur_arch, arch)
+    return _cur_arch
=====

 1. currentarch never None
 2. why we must make extra iteration with 'garbage' value?
 3. this nice example where reduce() is 'best practice'
 
 
 also, I extract archdict initialisation from availablearchs().   
 Why we at every call init constants?  
 
 and getArch() can be called once, with module import...
 
-- 
		Bor.


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux