HackerTrans
TopNewTrendsCommentsPastAskShowJobs

darkfirefly

no profile record

comments

darkfirefly
·4 years ago·discuss
I often experience very slow time to fix with cell service off (& having location off beforehand) - I believe this is due to Assisted GNSS/GPS which significantly improves the time for GPS to start working (the associated Wikipedia article states that ~1 minute often without it, and worst case ~12.5 minutes)
darkfirefly
·4 years ago·discuss
Python's default arguments are evaluated and stored once. This can cause issues, for example the naive "default to []" program:

    >>> def function(b, a=[]):
    ...     a.append(b)
    ...     print(a)
    ... 
    ...     
    >>> function(1)
    [1]
    >>> function(2)
    [1, 2]
    >>> function(3, [4])
    [4, 3]
    >>> function(5)
    [1, 2, 5]
A correct implementation would be:

    >>> def function2(b, a=None):
    ...     if a is None: a = []
    ...     a.append(b)
    ...     print(a)
darkfirefly
·4 years ago·discuss
Maybe uh... not like Wikipedia does https://en.wikipedia.org/wiki/WP:CANCER