What is the quickest way to check if a list is empty, and in what scenarios would one method be preferred over the other? I would like to know what would be the best way to check if a list is empty. I know this question seems silly, but I realize that sometimes when you are working with others and others read your code, using certain functions may look better than others, and would be more understandable for people coming from different programming languages. Say I have a list: names = [&quot;Bob&quot;, &quot;Billy&quot;, &quot;Samuel&quot;, &quot;Adam&quot;, &quot;Rob&quot;]  This is one way I can check if the list is empty: is_empty = bool(names)  This is another: is_empty = any(names)  I do realize the any function checks if there is at least 1 true value inside a list. What would be the best and quickest way to check if the list is empty? Which would look the best and in which scenarios? Are there any faster ways that I do not know of?
How do I check if a list is empty? For example, if passed the following:  a = []   How do I check to see if a is empty?
Can someone tell me how to get a closed form for  $$\sum_{k=1}^n k^p$$  For $p = 1$, it's just the classic $\frac{n(n+1)}2$.   What is it for $p &gt; 1$? Lock questions in the review queue while being reviewed More and more frequently in the review queues, I am spending time either fixing a post or considering whether an edit is valid, etc, only to make changes and have them denied/not count because someone else has blindly hit the approve button in the meantime.  My proposal is for the system to "lock" a post in the review queue once it has been presented to someone for review.  Do not let anyone else (in the review queue) do anything with it until it is released by the last user it was presented to (or a certain amount of time has elapsed).    By "lock" I mean that it won't show up in anyone elses list until released.  I did NOT mean that it would be in multiple queues and be unactionable in some of them.  This would fit well as the queues only present one at a time anyway.  This will allow people trying to make good decisions the time to do it and prevent someone else from making that effort a waste of time.  As support, look to some of the published reasoning behind the auto-question ban.  A large portion of it is that bad questions waste the time of the community.  Taking the time to ensure you are making a good decision in the /review queue only to have it not count because someone was badge-whoring and clicking the approve button as fast as they could also wastes the users time... arguably the more (for lack of a better way to put it) valuable user who is willing to invest some time and thought into making the site better. How did Harry become a Horcrux? To make a Horcrux, certainly murder can't be the only requirement. It is obvious a proper spell is needed for completing a Horcrux. Voldemort could have made a thousand Horcruxes, as he had already murdered a thousand people. But, how on earth did Harry become a Horcrux, with Voldemort murdering his mom and not using the Horcrux-making spell? Certainly Avada Kedavra is not the spell used for making a Horcrux. Ubuntu Software not loading categories How do I depower overpowered magic items without breaking immersion? A Hollow Black Hole I was just reading a . It was a trivial question, obviously there is no force felt. But then it got me thinking.  Suppose you had a hollow sphere that was massive enough that outside of it, it became a black hole. It's not hard to imagine a situation where the magnitude of the force of gravity at the surface (while strong) is equal to the magnitude of the force on the particles of the sphere due to some phenomenon involving one of the other 3 forces (just so I can allow this hollow sphere to continue being hollow).  Obviously, I don't have to do the integral to know that any object inside the hollow would experience no net gravitational force due to the shell. However, being a few months short of General Relativity, I am curious to know whether there would be any effects from Gravity observed.  Would an observer inside experience any time dilation? There may not be any net force due to gravity, but one cannot deny that there are still some fairly powerful gravitational fields present that happen to superimpose to zero. Furthermore, (assuming a relatively massless observer) would they have access to any of the information that was "lost" in the black hole? If so, then if they were long-lived enough for the black hole to be able to evaporate around them, does this mean that not only would the black hole radiate that information, but it would also store a copy of it in the hollow?  I want to apologize in advance. I know this question seems a bit more like a discussion than a Q&amp;A thing.  To be clear, I am asking: In my scenario, would there be any effects of gravity on things in the hollow? And would information lost in the black hole be accessible to the hollow (which is essentially its own isolated bubble of the universe)? A good answer can address these two questions. If you want to add in your own opinions/contribute to a discussion about it, that'd be a bonus. Why is unity feedback used? Why is the unity feedback system used? This block diagram is for a 2 DOF ball balancing using a PID controller. I have some Python code that makes Raster Attribute Tables for GeoTiffs using GDAL.    In ArcGIS I can see these attribute tables fine and they behave how I like (as classifications) but in QGIS the whole concept of an attribute table seems to be missing.    Is there any way to access a RAT in QGIS? Is there a word to describe someone who tends to disagree with others only to upset them? I want to add a comma in the thousands place for a number.     String.Format()? Hahn-Banach Theorem for separable spaces without Zorn's Lemma Normality of dependent variable = normality of residuals? This issue seems to rear its ugly head all the time, and I'm trying to decapitate it for my own understanding of statistics (and sanity!).   The assumptions of general linear models (t-test, ANOVA, regression etc.) include the "assumption of normality", but I have found this is rarely described clearly.   I often come across statistics textbooks / manuals / etc. simply stating that the "assumption of normality" applies to each group (i.e., categorical X variables), and we should we examining departures from normality for each group.   Questions:     does the assumption refer to the values of Y or the residuals of Y?  for a particular group, is it possible to have a strongly non-normal distribution of Y values (e.g., skewed) BUT an approximately (or at least more normal) distribution of residuals of Y?   Other sources describe that the assumption pertains to the residuals of the model (in cases where there are groups, e.g. t-tests / ANOVA), and we should be examining departures of normality of these residuals (i.e., only one Q-Q plot/test to run).  does normality of residuals for the model imply normality of residuals for the groups? In other words, should we just examine the model residuals (contrary to instructions in many texts)?  To put this in a context, consider this hypothetical example:   I want to compare tree height (Y) between two populations (X).   In one population the distribution of Y is strongly right-skewed (i.e., most trees short, very few tall), while the other is virtually normal  Height is higher overall in the normally distributed population (suggesting there may be a 'real' difference). Transformation of the data does not substantially improve the distribution of the first    population.  Firstly, is it valid to compare the groups given the radically different height distributions? How do I approach the "assumption of normality" here? Recall height in one population is not normally distributed. Do I examine residuals for both populations separately OR residuals for the model (t-test)?     Please refer to questions by number in replies, experience has shown me people get lost or sidetracked easily (especially me!). Keep in mind I am not a statistician; though I have a reasonably conceptual (i.e., not technical!) understanding of statistics.  P.S., I have searched the archives and read the following threads which have not cemented my understanding: I have two users, user1 and user2, that are both members of groupA. user2 has a folder in their home directory called folderA. If they wish to allow read-write-execute permissions for all members of groupA, how would they do this?  What if folderA contains many files and additional folders that also need to have read-write-execute permission?  Information regarding groups is a little 'spotty' across the web, so I am putting my question here in the hope someone posts a clear answer that might help others out too.  Thanks! How do I remove all attributes which are undefined or null in a JavaScript object?  (Question is similar to  for Arrays) How do I write a short literal in C++? Very basic question: how do I write a short literal in C++?  I know the following:   2 is an int 2U is an unsigned int 2L is a long 2LL is a long long 2.0f is a float 2.0 is a double '\2' is a char.   But how would I write a short literal?  I tried 2S but that gives a compiler warning. Prove that $\sqrt[n]{n!}$ is increasing and diverges I have to prove that $a_n$ is (strictly) increasing and diverges  $a_n = \sqrt[n]{n!}$ ;  n $\in$  $\ \mathbb{N}$  From sequence I see that $a_n$ increasing to infinitive.  $\sqrt[1]{1!}=1 ,\  \sqrt[2]{2!} \approx 1.41, \  \sqrt[3]{3!}  \approx 1.81 ,...,  \sqrt[n]{n!} $ double movement in Scrabble Can you resolve a dispute between myself and my girlfriend? She recently won a game with what I think is a double movement (although there's no mention of this in the rule book).  She put one two letters down to make one word, which also scored linked to another letter. But she then added another letter immediately to the left of the finished word, which then extended the second word. I just don't think you can make a second movement like this in scrabble!    My sister placed down W, D and E, the ones that I circled in red. Is she allowed to do that? I told her it was impossible is it?  Can you resolve this for me please? Concecutive last zeroes in expansion of $100!$ I have just updated (through Software Update) to Ubuntu 16.04 LTS from 15.10. There are random instances of screen flickering throughout usage. After noticing this issue, I installed Compiz Config Settings Manager, selecting Force fulls screen redraws (buffer swap) on repaint, which did nothing.   Is there any way this could be related to compiz settings or is this another issue?    EDIT: not fixed after clean install, upgrade to kernel 4.5.2, however screen flickering is reduced, it is every now and then (10 minutes apart). I will see if upgrading to kernel 4.6.0-994-generic will fix this.     EDIT: fixed as of kernel 4.6.2 generic,  currently running 4.7.2 without any issues. How to make sure that Thinkpad discharges external slice battery first? The thing is that when an external slice battery pack is connected, the laptop first discharges the internal one. This is a problem because then it is impossible to switch between multiple external battery packs without powering off the laptop. It is also not possible to just disconnect the external battery pack when you e.g. need to insert it into a docking station.  Thus, my question: how to change the discharge order under Linux?  For my use cases following order would make much more sense: when an external slice battery is connected, first discharge it completely before using power from the internal battery.  Background: For some Thinkpad models (e.g. X220) there are slice battery packs () available that you can connect to the bottom of the laptop (similar to a docking station).  They seem to be supported well on Linux - e.g. the Gnome Shell battery applet includes both batteries (internal and external) when connected - including displaying the current capacity for each.