522 messages found


Jun 29 22:00
And it would probably be more robust (read: paranoid) to work with something like git diff --cached --name-only --diff-filter=d -z | grep -qz '^tests/' assuming git bash supports all these. --diff-filter=d excludes deleted files (so that just deleting a test doesn't skip the hook), the -z flags ensure that you can handle zalgo in paths, and there's really no reason to catch a variable and echo it back if you can just pipe. Oh, and I'd definitely anchor the regex at the start.
Jun 28 18:04
With MATLAB's trash global variable list it should be trivial to dump a bit more crap in there...
May 7 21:07
> On Windows with shell=True, the COMSPEC environment variable specifies the default shell. The only time you need to specify shell=True on Windows is when the command you wish to execute is built into the shell (e.g. dir or copy). You do not need shell=True to run a batch file or console-based executable.
May 7 20:30
> On Windows, the current directory is always prepended to the path whether or not you use the default or provide your own, which is the behavior the command shell uses when finding executables. Additionally, when finding the cmd in the path, the PATHEXT environment variable is checked. For example, if you call shutil.which("python"), which() will search PATHEXT to know that it should look for python.exe within the path directories. For example, on Windows:
Jan 10 13:43
@zoomingspeed that also only works if you do global variable first
Jan 10 13:39
@zoomingspeed is your verse a variable at top level?
Dec 28, 2023 12:02
@Hakaishin nothing comes to mind, but your example is confusing because younonly have 3 filters if I believe your variable names
Nov 3, 2023 20:37
@Hakaishin "result is immediate and checking it is easy, whereas writing it is hard". Surely by "checking" you mean "run and see"? Because that's "easy" in the same way as it's easy to tell a poisonous mushroom by eating it. SQL injection vulnerabilities "work". So does most bash code until you get a space or an empty variable.
Feb 18, 2023 21:24
it's not a question of "oh no how do I change this variable to use a different key in my dict". It's "oh no this type is not hashasble so trying to use it as a dict key causes a TypeError!".
Jan 4, 2023 16:59
Nice, OP's "solved" edit posted as CW, deleted by review stackoverflow.com/questions/40748886/…
Sep 25, 2022 15:03
those variable names scare me
Jul 11, 2022 15:46
If you mean dynamic variable names: use a dict of indices
Jul 6, 2022 13:49
@Kevin but this seems different to me from the concern of having a variable that is very obviously a string literal. It's right there in its literalness.
Jun 30, 2022 20:36
@MisterMiyagi I agree, but: 1. that's very difficult, 2. that doesn't fit a Q&A platform, 3. even if you try that, the kind of people who ask on SO instead of dipping a toe in a proper tutorial will say "OK, so after a = value I added a = object(), so now it's a value and not a variable. It still doesn't work." instead of "oh, my fundamental understanding of the language is flawed, I must ponder this new development in the company of structured information aimed at beginners.".
Jun 29, 2022 22:32
@CodyGray no, just hoping that a variable living inside a function is also accessible from outside, by the same name. After the function's returned.
Jun 23, 2022 20:26
OK, I don't think that means that it holds a reference to the variable or the object if we're being technically correct.
Jun 20, 2022 17:45
It's a customary name for a variable you don't need. You could call it fig2
Jun 16, 2022 22:10
I assume there's actually a "=" and a variable name on the left of that call
Jun 8, 2022 23:29
cf. "Just google dynamic variable names"
Jun 5, 2022 11:48
that's exactly what a class variable sounds like
Jun 5, 2022 11:48
@DelriusEuphoria I have no idea what that understanding refers to. "access a variable", "without creating an instance of the class"?
Jun 5, 2022 10:24
@DelriusEuphoria what's a "static variable"?
Jun 1, 2022 21:30
May 4 at 20:02, by Karl Knechtel
https://stackoverflow.com/questions/72107971/why-is-list-of-dataframes-not-being-assigned-in-python there's a canonical for this, isn't there? The problem where OP expects reassigning an iteration variable to modify the original iterable?
May 19, 2022 21:26
if variable is not None would be more explicit, but no
May 19, 2022 21:24
What is your expected failure mode for that first test? What is the value of variable?
May 19, 2022 21:22
What does "variable is set" mean?
May 19, 2022 21:22
isinstance(variable, what?)
May 17, 2022 10:18
@SardarUsama oh brother. Not a joke. Dynamic variable names on steroids
May 10, 2022 20:38
@lupus It's not a problem if your variable names are meaningful. What might be a problem if your MCVE has 30 lines defining constants. I opened that, saw 173 lines in a pastebin, and closed it, because I don't have time for that much code right now. Seems like your problem is "I think some of my constraints in differential evolution aren't being called" which can probably be reproduced in less code. I'd probably try to whittle it down while I wait for replies.
May 6, 2022 18:57
(if open_file is still running when function2 is called, just pass on the variable to function2 during the call)
Apr 7, 2022 17:25
E.g. stackoverflow.com/questions/24277488/… but there's a better Q&A I can't find right now
Mar 27, 2022 11:41
@NordineLotfi I think what it's saying is that originally a list comp was really just a shortened for loop. This meant that the loop variable leaked into the enclosing scope, just like it does with for loops. But starting with 3.0 list comprehensions have their own locals, as if their insides were tucked away in a function. So when you do [thing for thang in foo] then thang won't interfere with the scope where this list comp is.
Mar 25, 2022 08:12
> Constrained type variables and bound type variables have different semantics in several important ways. Using a constrained type variable means that the TypeVar can only ever be solved as being exactly one of the constraints given:
> [...]
> Using a bound type variable, however, means that the TypeVar will be solved using the most specific type possible:
Feb 23, 2022 18:51
your current design looks a lot like using dynamic variable naming (one variable for each data point, not very extensible), which is to be avoided
Feb 22, 2022 11:14
The best way to assemble sparse matrices is to do it in one go. keep storing the values and indices and don't build it until you need it — Ander Biguri 39 secs ago
Feb 13, 2022 20:21
I'm already creeped out by greek letters being used for scientific code (i.e. to match formulae rather than natural language), so I find it hard not to think of "unicode subscript in variable name" as "shotgun attached to hip pointing down"
Feb 11, 2022 19:21
@roganjosh of course one could argue that this is a good sign that the masks should be pulled out into a new variable
Jan 29, 2022 18:28
You have a 4 (or 2) dimensional space: you need to store the position and velocity of your ball at wall hits. It's actually sort of 2d: one length parameter along your triangle, and one angular variable for the velocity.
Jan 20, 2022 16:17
Everything is hard and confusing and I just want my variable variables
Dec 14, 2021 15:08
I've never seen these underscored variable references in a spreadsheet; how do those work?
Nov 30, 2021 10:15
theming is the main point, but it also has things like a variable explorer and code exploration :P
Nov 19, 2021 18:45
those are pretty bad variable names, by the way
Nov 15, 2021 21:39
@AnderBiguri it's not clear to me how much is variable in your image
Nov 6, 2021 14:04
@discoMonkey for your technical question see stackoverflow.com/questions/5893163/…
Oct 24, 2021 19:10
I don't even understand any of "whenever I change an object's variable value, wherever it is on the file, it will be saved"
Oct 17, 2021 16:32
> Use ellipsis if the length is not set and the type should be repeated: Tuple[float, ...] describes a variable-length tuple with floats.
Oct 15, 2021 09:58
Oh, and the answerer's comment is also 100% bullyam, just like the answer. The question was asking the same thing in its initial revision.

1 2 3 4 5 11
variable