Changes between Initial Version and Version 1 of Ticket #27870


Ignore:
Timestamp:
Feb 22, 2017, 7:28:24 AM (8 years ago)
Author:
Phil
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #27870

    • Property Type UncategorizedCleanup/optimization
  • Ticket #27870 – Description

    initial v1  
    1 There are few thing in [core/management/__init__.py](https://github.com/django/django/blob/master/django/core/management/__init__.py) those look strange.
     1There are few thing in {{{core/management/__init__.py}}}(https://github.com/django/django/blob/master/django/core/management/__init__.py) those look strange.
    22
    3 1. In [line 257](https://github.com/django/django/blob/master/django/core/management/__init__.py#L257) there is the code like `sorted(x)[0]` which is similar to `min(x)`. But the second one looks better, works for O(N) but not O(N log N) and doesn't spend memory for the new object.
     31. In line 257(https://github.com/django/django/blob/master/django/core/management/__init__.py#L257) there is the code like `sorted(x)[0]` which is similar to `min(x)`. But the second one looks better, works for O(N) but not O(N log N) and doesn't spend memory for the new object.
    44Sure, time and memory optimizations are negligible in this case, but readability is more important.
    55
    6 2. In [line 261](https://github.com/django/django/blob/master/django/core/management/__init__.py#L261) we declare list of used options but use only to understand if option was already used. So while we don't need order, but only want to check, if option is already used. So set is better than list both semantically and  complexity (~ O(1) instead of O(N)).
     62. In line 261(https://github.com/django/django/blob/master/django/core/management/__init__.py#L261) we declare list of used options but use only to understand if option was already used. So while we don't need order, but only want to check, if option is already used. So set is better than list both semantically and  complexity (~ O(1) instead of O(N)).
Back to Top