6 ms·
Used to is the important word here. They improved a lot. I like them. MDN is great, but w3schools is better in giving examples on how to use stuff.
by onli 8y ago
Used to is the important word here. They improved a lot.
I like them. MDN is great, but w3schools is better in giving examples on how to use stuff.
- teddyh 8y agoI would rather use a site which started with correct documentation and added examples over time, than use a site which started full of bad documentation and examples, and slowly got corrections over time.
- onli 8y agoIf you use the site after it got corrected the difference is nil :)
- bryanrasmussen 8y agoI never use W3Schools but I have to say that I sort of feel bad about that because as a policy thing perhaps one should use something that has improved on bad behavior to become good in order to reward the improvement. Of course improvement without expectation of reward shows a higher moral stature, but it is a stature that is perhaps not to be expected, whereas improvement based on reward seems more likely to exist in our world - given studies of the matter.
- umanwizard 8y agoEDIT: It seems that Python lists are in fact arrays. Cool, so Python does in fact support arrays. Seems a pretty important fact to point out on a page called "Python Arrays". Original comment: There is still some complete nonsense on w3schools. For example, I wanted to know recently whether Python supports arrays. The first result on Google is this page: https://www.w3schools.com/python/python_arrays.asp https://www.w3schools.com/python/python_arrays.asp There is a small disclaimer at the top stating: "Note: Python does not have built-in support for Arrays, but Python Lists can be used instead." Why the fuck is your page called "Python Arrays" if you don't plan to talk about arrays? Then the rest of the page talks about lists, while erroneously calling them arrays, in complete defiance of the disclaimer. I imagine what happened is that someone who doesn't know what an array is wrote the page originally, then someone else came by later and realized it was wrong, but instead of actually fixing it, slapped that half-assed disclaimer on top. I still don't know whether stock Python actually supports arrays. I ended up just importing Numpy.
- kennydude 8y agoPython lists do the job of an array probably for 99% of cases. Depends on your exact definition of an array and if that even matters
- umanwizard 8y agoThe subway does the job of a car in 99% of cases. Doesn't mean they're the same thing. I also wouldn't appreciate an article about subways with the title "Cars". I have literally never seen or heard of a definition of array according to which lists are arrays -- can you cite one?
- anisppp 8y agoCan you cite a common definition of “array” other than a bare minimum of being randomly accessible? (Nothing else is pinned down. Fixed vs variable length, single vs mixed type, or even underlying data structure (cf NSArray)). By the only universal definition I can think of, python lists are arrays. Python lists most certainly meet the mathematical definition of array (ie name by index)
- umanwizard 8y agoIt seems you're right. Python lists are arrays -- I didn't know that. That makes my point even stronger. The article about "Python Arrays" directly claims that Python Arrays don't exist, which is apparently wrong! The whole point is that I came away from the article believing information that is false.
- ben509 8y agoArrays are commonly an implementation, while lists are the mathematical or logical structure. Same as how a hashtable is used to implement a mapping.
- jerf 8y agoAs always, as you say, it depends on your definition. One of the useful definitions of an array is that it guarantees contiguous storage in memory. In Python, there is no way to guarantee that; even if a list is a C array of Python references under the hood, there's no way to store the information represented by those references contiguously in memory. From that perspective, pure Python doesn't have any arrays at all, which is precisely why the popular NumPy has to offer explicit support for numeric arrays. From another perspective, arrays are a set of O() guarantees for various operations. From that perspective, Python lists will generally meet the specifications that you'd write for a resizable array, or perhaps what you might call "vector", depending. CPython comes with some awful constant factors but the O() of the lists will be what you'd expect. Rather than arguing about whether Python has "arrays" interminably, it's better to carefully define array, then dispassionately examine Python lists to see if they match that definiton. You'll get a yes sometimes and no others. I say "dispassionately" because too many people seem to assign moral qualities to whether or not something conforms to a given definition, but that's not a path to understanding. No matter what definition you write down for "array", not a single characteristic of Python will change.
- kevinsimper 8y agoI tried adding better examples for "alert"s for example, but my PR got not approved because it didn't fit the exact structure of how the wiki is structured. So they make it intentionally worse than w3schools :) https://github.com/mdn/interactive-examples/pull/1266 https://github.com/mdn/interactive-examples/pull/1266
- TheRealPomax 8y ago<h1>how to use alert()</h1> <p>see the Console API</p> <footer>don't use alert(), don't talk about alert(), don't teach alert(), it's not 1997 anymore</footer>
- sametmax 8y agoalert() is very handy to learn, as it gives the new commer something tangible and familiar to use for tests. You just have to give proper context.
- jimsmart 8y ago> proper context. That's not 'tests' — tests would be something like Mocha, or Jasmine — what you're actually talking about here is one of the many forms of ad hoc in-browser debugging.
- yorwba 8y agoAutomatic tests are not the only way to test software, nor are they sufficient. Whether some software can actually be used is not something that's completely formalizable and so you can't test it automatically. You always need a human in the loop in the end, and alert is a legitimate tool to effortlessly display some additional information on internal state during an interactive user test.
- johnfn 8y ago> ad hoc in-browser debugging Ah, if only there was a single word - a verb perhaps - that developers could use to colloquially refer to this process!
- NeedMoreTea 8y agoIt's a little like GoDaddy, or Facebook. W3schools were so bad, essentially just a click farm promoting any old crap for the pageview, that it'll take a huge amount of correcting, improving, and newly found ethical standards to let me forgive them. Or forget there really was a need for w3fools. They always gave lots of examples, and they were often simply wrong. Even when they apparently have the answer, until I can validate it on SO or some other place, I'll tend to not trusting...