curiousefficiency.org is a domain that was created on 2011-07-22,making it 13 years ago. It has several subdomains, such as python-notes.curiousefficiency.org , among others.
Description:Efficiency (a virtue) is the child of laziness and greed (both vices), while much of our economic activity is devoted to preventing boredom in the idle time created by increases in efficiency. To be...
Discover curiousefficiency.org website stats, rating, details and status online.Use our online tools to find owner and admin contact info. Find out where is server located.Read and write reviews or vote to improve it ranking. Check alliedvsaxis duplicates with related css, domain relations, most used words, social networks references. Go to regular site
HomePage size: 244.752 KB |
Page Load Time: 0.887429 Seconds |
Website IP Address: 104.21.25.225 |
** Curious Notions - Diary, Travel, Photography, Food Blog linda.curious-notions.net |
IXL Official Blog - Cultivating confident and curious learners blog.ixl.com |
Curious Cat Travel Photos travel-photos.curiouscatblog.net |
Susan Dennard's Writing Academy – A curious writer is a thriving one academy.susandennard.com |
Connecticut Public | CPTV | WNPR | Media for the curious content.ctpublic.org |
SpotHero Technology - Being Technically Curious Since 2010 technology.spothero.com |
Cars.com’s Guide for the EV Curious | Cars.com live.cars.com |
Tea Collection Blog – Globally inspired style for curious kids blog.teacollection.com |
Tours and activities service provider | Travel Curious partner.travelcurious.com |
Welcoming Curious Guests since 1775 - InterContinental Edinburgh The George edinburgh.intercontinental.com |
The Curious Diary of Mr Jam mrjam.typepad.com |
Find the Energy Efficiency Resources You Need | Energy Efficiency Program Library library.cee1.org |
Copenhagen Centre on Energy Efficiency - Copenhagen Centre on Energy Efficiency c2e2.unepccc.org |
Energy Efficiency Day 2023 | Philippine Energy Efficiency Alliance, Inc. eeday.pe2.org |
Curious Efficiency https://www.curiousefficiency.org/ |
Posts for year 2011 | Curious Efficiency https://www.curiousefficiency.org/2011/ |
Posts for year 2012 | Curious Efficiency https://www.curiousefficiency.org/2012/ |
Posts for year 2010 | Curious Efficiency https://www.curiousefficiency.org/2010/ |
Posts for year 2004 | Curious Efficiency https://www.curiousefficiency.org/2004/ |
Posts for year 2013 | Curious Efficiency https://www.curiousefficiency.org/2013/ |
Posts for year 2019 | Curious Efficiency https://www.curiousefficiency.org/2019/ |
Posts for year 2007 | Curious Efficiency https://www.curiousefficiency.org/2007/ |
Archive | Curious Efficiency https://www.curiousefficiency.org/archive.html |
Red Hat Supported Python Upgrade Paths - Curious Efficiency https://www.curiousefficiency.org/index-8.html |
A curiousefficiency.org. 300 IN A 172.67.134.207 |
AAAA curiousefficiency.org. 300 IN AAAA 2606:4700:3035::6815:19e1 |
MX curiousefficiency.org. 3600 IN MX 1 aspmx.l.google.com. |
NS curiousefficiency.org. 86400 IN NS dan.ns.cloudflare.com. |
TXT curiousefficiency.org. 300 IN TXT google-site-verification=L2akY7X3GIZJLg8BLzSvbVOrMUbIh6-7LWL-K1_l1mo |
SOA curiousefficiency.org. 1800 IN SOA dan.ns.cloudflare.com. dns.cloudflare.com. 2339640578 10000 2400 604800 1800 |
Date: Tue, 14 May 2024 07:13:24 GMT |
Content-Type: text/html; charset=utf-8 |
Transfer-Encoding: chunked |
Connection: keep-alive |
last-modified: Fri, 05 Apr 2024 11:45:50 GMT |
access-control-allow-origin: * |
expires: Tue, 14 May 2024 06:36:13 GMT |
Cache-Control: max-age=600 |
x-proxy-cache: MISS |
x-github-request-id: 9960:6DA7D:4EDC:5569:66430404 |
Age: 0 |
via: 1.1 varnish |
x-served-by: cache-lcy-eglc8600027-LCY |
x-cache: HIT |
x-cache-hits: 0 |
x-timer: S1715670804.301724,VS0,VE113 |
vary: Accept-Encoding |
x-fastly-request-id: 0b5117080ca9d0a9e8ff7dbb28df856885024512 |
CF-Cache-Status: DYNAMIC |
Report-To: "endpoints":["url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=qJsXvV%2Bg8DeA7UdakmECYz2qTK0z1YNzvCebarZpaJQAYRJ5eTFtDb8Mzn60MMAhXW1De7%2B7B1n4edv3Bhg0TNbYzqdO3DfaA2tisCEZ1ZtY12ADkCOEDKUpR%2BwZRTONqnk9BmqdmcAqBBmkiwjfgB5mpFYwhcOF"],"group":"cf-nel","max_age":604800 |
NEL: "success_fraction":0,"report_to":"cf-nel","max_age":604800 |
Server: cloudflare |
CF-RAY: 883915dec86d35db-LHR |
alt-svc: h3=":443"; ma=86400 |
charset="utf-8"/ |
content="width=device-width, initial-scale=1" name="viewport"/ |
content="#5670d4" name="theme-color"/ |
content="Nikola (getnikola.com)" name="generator"/ |
Archives Tags RSS Python Notes What does "x = a + b" mean? Alyssa Coghlan 2019-03-16 06:06 Comments Making sense of "x = a + b" Shorthand notations and shared context The original shared context: Algebra The corresponding Python context: Numbers Another mathematical context: Matrix algebra The corresponding Python context: NumPy Arrays Python’s string concatenation context Python’s immutable sequence concatenation context Python’s mutable sequence concatenation context A brief digression back to mathematics: Multisets And back to Python once more: collections.Counter What does all this have to do with the idea of dictionary addition? Shorthand notations and shared context Guido van Rossum recently put together an excellent post talking about the value of infix binary operators in making certain kinds of operations easier to reason about correctly. The context inspiring that post is a python-ideas discussion regarding the possibility of adding a shorthand spelling ( x = a + b ) to Python for the operation: x = a.copy() x.update(b) The PEP for that proposal is still in development, so I’m not going to link to it directly [ 1 ] , but the paragraph above gives the gist of the idea. Guido’s article came in response to the assertion that infix operators don’t improve readability, when we have plenty of empirical evidence to show that they do. Where this article comes from is a key point that Guido’s article mentions, but doesn’t emphasise: that those readability benefits rely heavily on implicitly shared context between the author of an expression and the readers of that expression. Without a previous agreement on the semantics, the only possible general answer to the question "What does x = a + b mean?" is "I need more information to answer that". The original shared context: Algebra If the additional information supplied is "This is an algebraic expression", then x = a + b is expressing a constraint on the permitted values of x , a , and b . Specifying x = a - b as an additional constraint would then further allow the reader to infer that x = a and b = 0 . The corresponding Python context: Numbers The use case for + in Python that most closely corresponds with algebra is using it with numbers - the key differences lie in the meaning of = , rather than the meaning of + . So if the additional information supplied is "This is a Python assignment statement; a and b are both well-behaved finite numbers", then the reader will be able to infer that x will be the sum of the two numbers. Inferring the exact numeric type of x would require yet more information about the types of a and b , as types implementing the numeric + operator are expected to participate in a type coercion protocol that gives both operands a chance to carry out the operation, and only raises TypeError if neither type understands the other. The original algebraic meaning then gets expressed in Python as assert x == a + b , and successful execution of the assignment statement ensures that assertion will pass. In this context, types implementing the + operator are expected to provide all the properties that would be expected of the corresponding mathematical concepts ( a + b == b + a , a + (b + c) == (a + b) + c , etc), subject to the limitations of performing calculations on computers that actually exist. Another mathematical context: Matrix algebra If the given expression used uppercase letters, as in X = A + B , then the additional information supplied may instead be "This is a matrix algebra expression". (It’s a notational convention in mathematics that matrices be assigned uppercase letters, while lowercase letters indicate scalar values) For matrices, addition and subtraction are defined as only being valid between matrices of the same size and shape, so if X = A - B were to be supplied as an additional constraint, then the implications would be: X , A and B are all the same size and shape B consists entirely of zeroes X = A The corresponding Python context: NumPy Arrays The numpy.ndarray type, and other types implementing the same API, bring the semantics of matrix algebra to Python programming, similar to the way that the builtin numeric types bring the semantics of scalar algebra. This means that if the additional information supplied is "This is a Python assignment statement; A and B are both matrices of the same size and shape containing well-behaved finite numbers", then the reader will be able to infer that X will be a new matrix of the same shape and size as matrices A and B , with each element in X being the sum of the corresponding elements in A and B . As with scalar algebra, inferring the exact numeric type of the elements of X would require more information about the types of the elements in A and B , the original algebraic meaning gets expressed in Python as assert X == A + B , successful execution of the assignment statement ensures that assertion will pass, and types implementing + in this context are expected to provide the properties that would be expected of a matrix in mathematics. Python’s string concatenation context Mathematics doesn’t provide a convenient infix notation for concatenating two strings together (aside from writing their names directly next to each other), so programming language designers are forced to choose one. While this does vary across languages, the most common choice is the one that Python uses: the + operator. This is formally a distinct operation from numeric addition, with different semantic expectations, and CPython’s C API somewhat coincidentally ended up reflecting that distinction by offering two different ways of implementing + on a type: the tp_number-nb_add and tp_sequence-sq_concat slots. (This distinction is absent at the Python level: only __add__ , __radd__ and __iadd__ are exposed, and they always populate the relevant tp_number slots in CPython) The key semantic difference between algebraic addition and string concatenation is that in algebraic addition, the order of the operands doesn’t matter ( a + b == b + a ), while in the string concatenation case, the order of the operands determines which items appear first in the result (e.g. "Hello" + "World" == "HelloWorld" vs "World" + "Hello" == "WorldHello" ). This means that a + b == b + a being true when concatenating strings indicates that either one or both strings are empty, or else the two strings are identical. Another less obvious semantic difference is that strings don’t participate in the type coercion protocol that is defined for numbers: if the right hand operand isn’t a string (or string subclass) instance, they’ll raise TypeError immediately, rather than letting the other operand attempt the operation. Python’s immutable sequence concatenation context Python goes further than merely allowing + to be used for string concatenation: it allows it to be used for arbitrary sequence concatenation. For immutable container types like tuple , this closely parallels the way that string concatenation works: a new immutable instance of the same type is created containing references to the same items referenced by the original operands:a = 1, 2, 3b = 4, 5, 6x = a + ba (1, 2, 3)b (4, 5, 6)x (1, 2, 3, 4, 5, 6) As for strings, immutable sequences will usually only interact with other instances of the same type (or subclasses), even when the x += b notation is used as an alternative to x = x + b . For example:x = 1, 2, 3x += [4, 5, 6] Traceback (most recent call last): File "stdin", line 1, in module TypeError: can only concatenate tuple (not "list") to tuplex += 4, 5, 6x (1, 2, 3, 4, 5, 6) In addition to str , the tuple , and bytes types implement these concatenation semantics. range and memoryview , while otherwise implementing the Sequence API, don’t support concatenation operations. Python’s mutable sequence concatenation context Mutable sequence types add yet another variation to the possible meanings of + in Python. For the specific example of x = a + b , they’re very similar...
Domain Name: curiousefficiency.org Registry Domain ID: 2cd468d4d54a445cb181a10d41fb501e-LROR Registrar WHOIS Server: http://whois.cloudflare.com Registrar URL: http://www.cloudflare.com Updated Date: 2023-08-07T02:01:35Z Creation Date: 2011-07-22T02:59:27Z Registry Expiry Date: 2025-07-22T02:59:27Z Registrar: CloudFlare, Inc. Registrar IANA ID: 1910 Registrar Abuse Contact Email: registrar-abuse@cloudflare.com Registrar Abuse Contact Phone: +1.6503198930 Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited Registrant State/Province: Queensland Registrant Country: AU Name Server: dan.ns.cloudflare.com Name Server: lola.ns.cloudflare.com DNSSEC: unsigned >>> Last update of WHOIS database: 2024-05-17T19:28:08Z <<<