I ran into this expression in a question here about :  def f(v, i, S):   if i &gt;= len(v): return 1 if S == 0 else 0   count = f(v, i + 1, S)   count += f(v, i + 1, S - v[i])   return count   When I try to write out line two if i &gt;= len(v): return 1 if S == 0 else 0 in a more general form I get an error:  In [3]: if test1 : print x if test2 else print y    File "&lt;ipython-input-3-9d4131fa0c48&gt;", line 1     if test1 : print x if test2 else print y                      ^ SyntaxError: Missing parentheses in call to 'print'    Here is a generalized form:  In [16]: if True : print("first") if True else print("second")  first  In [17]: if True : print("first") if False else print("second") second  In [18]: if False : print("first") if True else print("second") [nothing]  In [19]: if False : print("first") if False else print("second") [nothing]   What do you call this?  I'm surprised you can just take out the second positive case for if...then...else and turn it into if...else.    UPDATE: Sorry bout the python3 noob mistake, I just wasn't paying attention. As noted, the answers don't make sense without the mistake, so I've striked out the erroneous code.
If Python does not have a ternary conditional operator, is it possible to simulate one using other language constructs?
If $(A-\lambda{I})$ is $\lambda$-equivalent to $(B-\lambda{I})$ then $A$ is similar to $B$ How do I create an immutable Class? How to open a folder in Finder by a single mouse click? (using Icon view) Is there a setting, key combination or similar to open a folder/subfolder in Finder with a single mouse click ?  I need a general solution which works on any folder in effort to minimize needless clicking ... that tiny triangle aside the folder icon will work yet its just too small and only appears using list view ... inspired by same behavior on osx inside a browser to hold down command key and single click a web link ... forcing users to double click is so 20th Century  Is there a way to enable this on macOS (High Sierra or higher)?  On ubuntu this single click preference is a simple setting ;-) Python: List vs Dict for look up table I have about 10million values that I need to put in some type of look up table, so I was wondering which would be more efficient a list or dict?  I know you can do something like this for both:  if something in dict_of_stuff:     pass   and  if something in list_of_stuff:     pass   My thought is the dict will be faster and more efficient.  Thanks for your help.  EDIT 1  Little more info on what I'm trying to do.  .  I'm making a look up table to see if a value calculated has all ready been calculated.   EDIT 2  Efficiency for look up.  EDIT 3  There are no values assosiated with the value...so would a set be better? Make voting activity on your posts available on site metas (what you would get from rep if metas had rep) Child metas don't have rep, so there's no point in tracking a rep stat or reporting changes.  But one of the things rep updates do on main sites is to alert me when there's activity on older posts.  On metas, unless I revisit a question I'll never notice that there's been a bunch of voting (which might be accompanied by new comments that didn't ping me).  I'd like to know about that activity, not because of any ego reasons but because meta is where site policies get discussed and set and it's useful to know about changes in the community will.  A couple days ago I visited a meta post where, a few weeks ago, my answer had been voted down, and this time it was at the top.  Could we have something like the reputation-changes tab on meta?  I suspect that the data already exists, because I once  (and I see I'm not the only one).  If something akin to reputation is already being tracked internally on per-site metas, can we get it exposed? I have been trying to solve this problem for quite a while. I am still unsure of whether any of the avenues I have pursued have been of any use. Any advice will be much appreciated. Question: Let $V$ be a finite-dimensional inner product space, and let $E$ be an idempotent linear operator on $V$. Prove that if $EE^* = E^*E$, then $E$ is self-adjoint. (This is essentially exercise 5(a) in sec. 80 on p.162 of Paul R. Halmos, Finite-Dimensional Vector Spaces, but Halmos didn't assume that the dimension of $V$ is finite.) What happens when you target a "magical effect" with Dispel Magic? Not all files are visible over MTP I have LG L5 (e610 model) device with Cyanogenmod 10. When I connect the phone to a computer with Linux (I have mtpfs installed), I can see both internal storage and the SD card.  However when I navigate inside them, I can't see some of the files.  For example, if I open file manager app on the phone, I can see several files in the Internal storage/Notifications directory, however the directory on the computer only shows one of those files.  If I switch USB connection type to PTP (camera) - as OS X doesn't support MTP natively - Image Capture sees the phone as a camera, however it can only see about a third of all the images present on the phone.  I don't have a Windows machine to try, but I suspect the results would be similar.  I tried upgrading Cyanogenmod to the latest nightly, clearing and reinstalling it - same results.  Any idea as to what is going on?  How can I make all files appear on the host computer? My understanding is that when using a Bayesian approach to estimate parameter values:   The posterior distribution is the combination of the prior distribution and the likelihood distribution. We simulate this by generating a sample from the posterior distribution (e.g., using a Metropolis-Hasting algorithm to generate values, and accept them if they are above a certain threshold of probability to belong to the posterior distribution). Once we have generated this sample, we use it to approximate the posterior distribution, and things like its mean.   But, I feel like I must be misunderstanding something. It sounds like we have a posterior distribution and then sample from it, and then use that sample as an approximation of the posterior distribution. But if we have the posterior distribution to begin with why do we need to sample from it to approximate it? How to enable bullet points when using the presento beamer theme? I have the problem that when I use an itemize list and the , there are no bullet points.  Here is a minimal working example (requires the  not available on CTAN to be downloaded first):  \documentclass{beamer} \usepackage{config/presento} \begin{document} \begin{frame} \begin{itemize} \item ... \item ... \item ... \end{itemize} \end{frame} \end{document}     How to fix this problem? Compound possessives and yours What is the difference between "is subject to" and "is subjected to"? I found the following sentence on the U.S. Customs and Border Protection website:     All persons, baggage, and other merchandise arriving in or leaving the   United States are subject to inspection and search by CBP officers.   I would like to know whether changing "subject" to "subjected" will change the meaning of the sentence. why does files (nautilus) open a new window although there's one already open? When I click on "files" in the launcher it opens another window although the normal action is to maximize the window already open. It doesn't always do that. Is it a bug? I recently switched from my beloved MacBook Pro Retina (Late 2013) i5 2.6/16/512 to MacBook Pro (2017) Non-TB i5 2.3/16/512.  I purchased what from the build-quality looked like a good USB-C-to-DisplayPort cable with 4k/60Hz support, just to run into the very problem the Logicboard repair guru Louis Rossmann had described in : As soon as you plug in the USB-C dongle, the (2.4 GHz) Wifi stops working despite full antenna signal. Unplug the USB-C connector and you are immediately back in the game.  The big question I'm asking myself now: Who is to blame? Is this a design flaw in the current generation MacBooks with improper shielding or is it a design flaw in the various dongles?  I mean the fact that even Apple’s very own USB-C Digital AV Multiport Adapter is causing these WiFi issues (as you can learn from the many horrific ; but AFAIK have been fixed through a ), show that there’s something going horribly wrong. Why does demand for stock rise when a company appears to have high future value? 'setenv' command not working on tcsh shell when called explicitly I can run setenv command just fine in my tcsh shell like this:  echo $0 /usr/bin/tcsh echo $SHELL /usr/bin/tcsh setenv START_TIME `date +%s` echo $START_TIME 1499355967   But, whenever I run it explicitly like shown below, it doesn't work. I need to do this because I have to specify shell when executing it via python subprocess call, otherwise it will call a sh shell as default.  /usr/bin/tcsh -i -f -c 'setenv START_TIME `date +%s`' echo $START_TIME START_TIME: Undefined variable.   What's the problem here? I searched for this issue online, but couldn't find any issue similar to this. This is extremely frustrating. Someone needs to set the record straight on what exactly antiderivatives vary by: constants functions or piecewise constant functions. Applying for a USA B1/B2 Visa for an alien resident in Germany I hold an EU Blue Card and an Indian Passport and have submitted a paper to a conference in the USA due to occur in September 2019. The Blue Card will expire in August 2019 but have already obtained an extension for the same.  In order to present the paper in the conference I need to apply for a B1/B2 visa for the USA and not sure if I may be allowed to apply for one in Germany since I am not a German Citizen.  Are there any specific documents that I might need in order to apply for the B1/B2 Visa since I am not a citizen of the country where I am actually applying? Install Nvidia driver instead of nouveau I've installed Ubuntu 14.04 and I'm experiencing a fuzzy/blurry screen and bad support for multiple screens.  I realized that Ubuntu installs nouveau as default, but I need to install nvidia drivers, so I tried this:   sudo apt-add-repository ppa:ubuntu-x-swat/x-updates apt-get update apt-get install nvidia-current apt-get upgrade       Now that nvidia is installed, you need to blacklist the nouveau driver   so it don’t pop out when you will reboot. Create or edit the following   file:  nano /etc/modprobe.d/blacklist-nouveau.conf       …and add these lines at the end:  blacklist nouveau blacklist lbm-nouveau options nouveau modeset=0 alias nouveau off alias lbm-nouveau off    I checked via the software &amp; updates if nvidia driver got installed successfully, and it says the driver installed is nvidia 304.117  I then tried to run:  lshw -c video | grep 'configuration'   and the result is that the driver is still nouveau:  configuration: driver=nouveau latency=0   So how do I install and use the nvidia drivers? Limit connection rights on SQL Server I have an app to deploy in production that uses 'honor system' security. That is, all users connect to the DB using a SQL user/passwd credential and the app manages permissions itself. The latter part doesn't bother me as much as the fact that the connection object contains embedded credentials and can be copied around freely. I'm try to find some way to limit connections to a more limited set of clients. I can create firewall rules to limit by IP, of course. Is there any way to 'prequalify' SQL logins either by Machine account or domain membership?