« first day (3537 days earlier)      last day (1402 days later) » 

3:13 AM
stackoverflow.com/questions/62506829/… and I don't know why people who should know better keep answering these questions instead of leaving a comment.
 
3:28 AM
is python smart enough to factor out caling a function and getting the same return value in a for loop? Or should I just call that function once outside of the loop and use the variable in the loop?
 
3:52 AM
CPython does not have do any of that as the interpreter is completely naive and will execute all bytecode as-is - if that "factor out" is what you want, have a look at pypy - see stackoverflow.com/questions/2591879/…
Alternatively, use functools.lru_cache.
 
ok thanks
 
4:08 AM
@aadibajpai Start a PR if you think they should be updates :)
 
4:24 AM
The whole fstring discussion is moot for logging anyway because doing logger.info(f'some {token}') should produce the desired output anyway without having to pass additional arguments to the function - the arguments passed are meant for composition and formatting later within the function itself.
>>> import logging
>>> logger = logging.getLogger()
>>> logger.warning(f'the logger is {logger}')
the logger is <RootLogger root (WARNING)>
 
 
1 hour later…
5:53 AM
@MisterMiyagi The last time I used spyder on Windows was back in 2013, and it was nice and fast, but also unstable and sometimes hung/crashed. It bit me once too many so I stopped using it. So yes always try to repro on another IDE or plain python executable.
 
@Arne is just adapting this to python3 cool enough or is there a better decorator in your experience? stackoverflow.com/a/6200396/9044659
looks like there are python3 versions there too
 
6:08 AM
looks good, apart from using %-string formatting instead of f-strings. two other possible features to add could be 1) auto-shortening values to at most ~20 characters, so that passing a big list to a function doesn't clog up your logs, and 2) allowing the decorator to be parametrized with the log-level it should log on
 
6:24 AM
@Arne so if you shorten then it just truncates and leave info out or some other way? also I saw it uses print statements, once I convert it to logging, is this more of an info thing or debug by default? I was thinking info and then the user could pass on the log level like you said, if they want a different level.
 
6:55 AM
correct on both accounts. if you implement both, you can also parametrize the truncation threshold, and e.g. pass -1 to disable it if you really do need all values in their full length.
 
7:41 AM
anybody have troubles using re.compile?
rr = re.compile("hi")
rr.match(some_string) # returns None

but this works,
re.match("hi", some_string)
 
MCVE?
 
one sec
do'h I need to stick to either re.match or re.search, I'll look into it a bit later
 
7:57 AM
@aadibajpai the point of logging is that it formats only when emitting a log. An f-string is resolved immediately, so it always performs the formatting.
 
a b c marker
0 12 31 31 0
1 34 52 4 0
2 32 4 5 1
3 7 89 2 0

I want to split a pandas dataframe into multiple dataframes at the places where a marker variable is True or 1. So in this example rows 0 and 1 would be a new df and rows 2 and 3 would be a new df. Is there a certain term I could search for?
 
@aadibajpai be careful. this decorator does not actually call the decorated function.
 
8:16 AM
rr = re.compile("^hi")
some_string = "helloy my name is\nhi"
print(rr.search(some_string, re.MULTILINE)  # None
print(re.search("^hi", some_string, re.MULTILINE))  # finds the match!
what gives?
 
Pattern.search(string[, pos[, endpos]]) vs re.search(pattern, string, flags=0)
 
@jigglypuff the parameters to pattern.search do not do what you think they do
 
@MisterMiyagi Checkmate! Your annotation parser is broken after all!
>>> T = TypeVar('T')
>>> List[T][T][T][T][int]
typing.List[int]
 
user11702787
question about ini files, I have this key, values parity=serial.PARITY_NONE
 
@Aran-Fey I'm decently sure that's not well-defined meaning :P
 
user11702787
8:23 AM
serial.PARITY_NONE is a class method, how can I insert this values a class method and not as a string ?
 
ini files are text, you cannot insert methods
 
It's somewhat by design because that's how you create your own generic - you do class MyList(List[T])
 
@Aran-Fey @MisterMiyagi can you guys elaborate? I don't quite understand why a match isn't found
 
@Aran-Fey That just gives you a MyList[T] then, though
@jigglypuff check the docs on what the second argument to rr.search means.
you might also want to take a look at the value and type of re.MULTILINE
 
@MisterMiyagi ah ok just found it, so how do I pass re.MULTILINE to pattern.search?
 
8:26 AM
@jigglypuff you must pass the flags to re.compile
 
ahh yep
thanks
 
@MisterMiyagi Um, do you consider MyList and MyList[T] to be equivalent? Because as far as I can tell that results in MyList (which is a class), not MyList[T] (which is a _GenericAlias)
 
@Aran-Fey error: Invalid type comment or annotation :P
 
That's from mypy? Good to know
 
The ":P" is not from mypy :P
 
8:31 AM
Yeah, I figured :P
 
@Aran-Fey Hm, good question. Logically, I'd say they are equivalent - with MyList being the runtime and MyList[T] being the static type representation of the same thing.
 
I need help deciding how to handle this... I have a function that retrieves the type arguments (i.e. the stuff inside square brackets) of an annotation. What result would you expect from calling this function on List[T]?
 
That's of course only if T is a free TypeVar, not a bound/constraint one.
 
>>> get_args(List[int])
(int,)
>>> get_args(List)
TypeError: List has no args
>>> get_args(MyList)
TypeError: MyList has no args
>>> get_args(List[T])
???
 
8:36 AM
ok, good. That's what I'd expect, as well
 
eh.... problem is, the typevar does not carry all information it should.
 
Although it's weird that you get a different result just by subclassing it
 
@Aran-Fey IIRC there's a version incomparability with that, but I can't remember what it was it was. It seemed pretty well defined however, even with multiple typevars.
 
@MisterMiyagi What do you mean? What's missing?
 
good asker but problem is no repro stackoverflow.com/questions/62484363/…
 
8:40 AM
@Aran-Fey Following Python's conventions it should be a TypeError as it has no args it has parameters
Actually I think I'm misremembering, parameters is the one that drops args
 
The difference being that TypeVar = parameter and anything else = argument?
 
As far as I remember, yes except everything are arguments (as otherwise you'd need a third function). You replace parameters when you do Foo[T, T] For example Foo[T1, int, T2][str, bool] produces Foo[str, int, bool] as you'd expect
 
Hmm, yeah, that makes sense
 
@aadibajpai on second thought, the post you linked had a few deficiencies, like not using functools.wraps and inspecting the code object by hand instead of using the inspect module. So this here is more or less what I had in mind.
 
Ah, ok, so here's the problem: List[T] stops being equivalent to MyList when T has contraints or a bound. Consider:
>>> E = TypeVar('E', bound=Exception)
>>> List[E][int]
typing.List[int]
There's no way to tell that this bound ever existed
 
8:55 AM
Hello
 
Oh, yeah that's not great.
 
I have eddted a closed question.
Is there something i can do to re-open it?
 
Editing puts it in the reopen queue
 
The first time a closed question is edited, it's automatically put into the reopen queue
 
Great
 
8:57 AM
So you better make that edit count
 
@Aran-Fey There was a way to do that, but I think it was removed in 3.7
 
TIL stuff like Union[int, Tuple[T, int]][str] is possible
 
Ah, I got it the way you could do it in 3.5 was because __origin__ acted more like 'previous type' than origin type you could walk the 'tree/graph'.
>>> typing.List[T][int].__origin__ == typing.List[T]
True
>>> typing.List[T][int].__origin__.__origin__ == typing.List
True
 
9:14 AM
Wonder why that got removed
 
@MisterMiyagi I don't get it, what would the difference effectively be?
@Arne thank you!
 
formatting can be expensive if, for example, you log a list with 10 million entries. If you create the log message by hand with an fstring, creating a string from the list will happen no matter what. if you let the logger handle the formatting, it will first check if the loglevel is high enough before doing it.
i think that is what miyagi means
 
9:30 AM
needs more focus (OP wants recursion explained in general) stackoverflow.com/questions/62377033/…
 
what does letting the logger handle the formatting mean?
 
@ChrisP Is there some reason why you don't want people looking at the main Python tag to see your question? All Python questions should have the generic tag. Also, you should make it more clear what the undesirable things are that your posted code is doing. Currently, the description is only slightly better than "it doesn't scroll how I expect".
 
@aadibajpai There a recipe for that
 
@aadibajpai Basically what Arne said. Especially the lower log levels should carry lots of information (== expensive to format) but are usually omitted (== format is wasted). So ideally formatting only runs when the output is actually needed.
 
so I should not format info or debug or any logging calls with f-strings?
 
9:37 AM
@Aran-Fey The context in which the T is used. E.g. if you have a (List[T], Callable[[T, T], T]) -> T then that implies some constraints on what values T will have. But if you just know you have a List[T] then you do not know whether the TypeVar is related to some other object (e.g. the Callable) or not.
@aadibajpai ideally, yes.
 
does it make a difference if I'm not really processing tons of data?
f-strings are pretty convenient to use
 
yes, logging itself has some pretty hefty overhead. If you're just formatting a few ints, strings or even small lists, f-strings are perfectly fine.
 
awesome, that is exactly what I am formatting
logging has been good so far but I noped out real fast in the section they talked about handlers and formatters and whatnot. idk if I'll ever need all that
 
IMO logging is quite a bit over-engineered.
But the basic architecture of Loggers, Handlers and Formatters is quite useful.
 
@MisterMiyagi I mean, till yesterday I was getting by with print statements so I'd agree
 
9:49 AM
E.g. depending on your target system, you might want to switch from log files to stderr (handlers). Similarly, different log formats are quite useful for low/high information density logs. Loggers really help to separate that one, failing component from the noise of all the others.
@aadibajpai It's one of those things you start to appreciate once you carry a service from dev to prod and onwards.
 
yeah I think it is high time I added a staging domain, my only qualm is that it used to be the prod domain previously until I switched to a custom domain and while most users made the switch I still get a couple of requests on it every day sigh
but having debug on staging and then promoting it to prod would be an awesome setup
(also I should stop sneaky tests on prod)
 
This question's OP just edited the title to 'UNANSWERED' when they already got two answers... I can't understand the OP. Can someone intervene and help them clean it up before it becomes a big mess?
 
just roll it back for now and tell them not to edit fluff into their titles
if they do it again, flag for a mod (otherwise you could start a rollback war)
 
@AndrasDeak I'm logging off now, I'm too tired to deal with that one now.
 
OK, I'll roll it back
 
9:56 AM
Ah, the classical "My game works fine for <single thing> using global, but I want <two things>".
 
@MisterMiyagi Oh God. They have bullet as a global. So much for OO decomposition.
 
It's really a classic blunder of budding game designers. Did it myself. Learned through pain and missery.
Which probably means the OP won't understand a proper answer, since they likely don't understand the problem yet. :/
 
Why does mypy complain about error: Need type annotation for 'value' here? (In the line self.value = value)
T = TypeVar('T', int, str)

class MyGen(Generic[T]):
    def __init__(self, value: T):
        self.value = value

v: MyGen[int]
v = MyGen(3)
 
I would guess it's because you haven't defined the attribute's type
 
Oh, it means it's too stupid to infer the type of self.value -.-'
 
11:08 AM
@MisterMiyagi I VTC'd as unclear, and left a comment.
 
11:19 AM
Hi, I have a very strange pycharm issue. When I run netstat -ab I get:
[pycharm64.exe]
TCP    127.0.0.1:49310        PC0014:49311           ESTABLISHED
[pycharm64.exe]
TCP    127.0.0.1:49311        PC0014:49310           ESTABLISHED
I get a staircase like this from 10 to 11 and back then from 12 to 13 and back and so on for some 30 ports. It's kinda unsettling
And this is without running anything inside of pycharm
I mean it wouldn't bother me, but I got: "An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full" and read that it is because I'm running out of sockets. But does anybody have a clue what these sockets pointing to my own pc do?
because PC0014 is my own account
 
Do you have docker with your pycharm?
 
no, except if it is default
 
Nah, seems it'd need plugin integration
Most search hits turned up docker stuff though, which is why I asked
 
11:35 AM
Hmmm if I have:
class RelayControl:
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    def send_msg(self, name, on):
        msg = self.create_msg(name, on)
        self.sock.sendto(msg, (self.ip, self.port))
this won't create all the time new sockets right?
 
Is there no binding to self.sock anywhere?
 
no, do I need that?
 
No. Just making sure. If there's no self.sock = ... anywhere then sock belongs to RelayControl the class, so in principle one python process should have one socket
 
yeah and I use the class like this:
relay_control = RelayControl(args, log)
while True:
    for label in args.labels:
        relay_control.send_msg(label, True)
    	time.sleep(3)
It ran fine for about 1h then it crashed with the not enough buffers space message above. Which sounds to me like new sockets were created
but I'm not sure
Oh wait I also do requests.get(url)
is it possible that request keeps generating new sockets?
 
@Aran-Fey That's strange. It works when value is a concrete type (value: int) or an unbound TypeVar (T = TypeVar('T')).
 
11:48 AM
@Hakaishin just fyi, it will use one socket regardless of how many instances you have. i doubt that's what you want. better define the socket in __init__
 
Also works with T = TypeVar('T', bound=Union[int, str]) strangely enough.
 
hah, good to know I'm not the only one who's struggling with typing stuff
 
I only ever have unconstraint or bound= TypeVars, so I never encountered this.
IMO the docs on bound TypeVars are very bad. :/
Still not sure on the difference between TypeVar('T', bound=Union[int, str]) and TypeVar('T', int, str).
 
they have different __bound__? :P
 
@ThiefMaster no that is what I want
 
11:52 AM
Well, if you don't use Union you can customize the variance, right?
 
@Hakaishin: then using a class is probably not the best idea
 
on second thought, I'm not sure if that even makes a difference
 
why?
 
Also, why is TypeVar('T', int) not allowed and how would it be different from TypeVar('T', bound=int)?
 
I only create one instance of relay_control = RelayControl(args, log)
also gunicorn keeps swalling my logging logs and I'm not sure how to make it stop :P
 
12:00 PM
Let's use the filesystem as a DB they said. What could possibly go wrong, they said? Who'd ever run more than 2k jobs, they said. -bash: /usr/bin/rm: Argument list too long, it said.
@Aran-Fey That's the stuff I plain don't get. Are these actually different? Does the tooling just treat them different? I have literally no idea.
 
@MisterMiyagi xargs?
 
Well, python actually won't let you instantiate the former at all, so the tooling isn't affected
>>> TypeVar('T', int)
TypeError: A single constraint is not allowed
 
@AndrasDeak I've managed to kill it by just wiping the entire directory structure. Only took 15 minutes. And the devs wonder why we complain their Bunch of Scripts doing the same just slower does not scale...
 
What exactly was the problem? That's not clear to me.
 
@Aran-Fey Isn't that saying T = int. At which point why is it a TypeVar and not just an alias?
 
12:12 PM
Because you can also make it covariant and/or contravariant
If you don't change the variance then there's no difference between TypeVar(bound=int) and just int either, is there?
 
How i can i get the coordinates of a tkinter widget displayed with place(x=...,y=...)?
Just winfo_width() or something else?
 
winfo_x(), winfo_y(), I think
 
@Aran-Fey My interpretation of the PEP is that TypeVar(bound=int) means it has to be a subclass/subinstance of int it can't actually be int.
 
hmm, mypy will accept int there
 
The example also shows a list and a set merging into a Collection which I don't think is valid when it's not bound.
@Aran-Fey Oh, I guess my interpretation is wrong.
 
12:22 PM
Well, it's not valid because you can't call len on x and y if they aren't guaranteed to be Sized
 
@AndrasDeak The middleware of our legacy frontend for our batch cluster is a text-book example for anti-patterns of scalable software design. The core problem is that they store the meta-data of each jobs as individual files in one single, flat directory. Processes regularly do an O(n) scan of the entire directory to look for changes.
 
lol
It somehow seems odd to have “the default” and “it's probably not what you want” describe the same thing 😃 ...

“If the disable_existing_loggers key in the LOGGING dictConfig is set to True (which is the default) then all loggers from the default configuration will be disabled. Disabled loggers are not the same as removed; the logger will still exist, but will silently discard anything logged to it, not even propagating entries to a parent logger. Thus you should be very careful using 'disable_existing_loggers': True; it’s probably not what you want. Instead, you can set disable_existing_l
 
btw what is the difference between python setup.py install and pip install .? I have found something that lists the former in their readme and googling shows me the former method is deprecated (docs are python 2)
 
I'm not sure, but I think installing via setup.py will use distutils to install, which doesn't include usefful features like being able to uninstall cleanly.
 
Also, isn't pip responsible for installing dependencies? Will the setup.py do that for you?
 
12:33 PM
setup.py does include dependencies
and I think it does
 
@Aran-Fey If you use something like TypeVar('ST', List[Any], Set[Any], Collection[Any], Sized) you can. But using reveal_type we can see the internal type information is Any and we can't replace it with T as T won't be bound. It seems to allow you to merge type information from subclasses easily.
 
What's reveal_type?
 
ok well so much for my logging endeavours. I noticed on pythonanywhere (where my backend is hosted), that even logging.info() went into both server log and error log
Yeah. That is a bit confusing - if you're just printing, we capture stdout to the server log and stderr to the error log. When you use the logging library, we capture calls to the logger and send the output to both. It's that way mainly so that we can be sure that no matter the logging configuration (different frameworks set up logging differently), the user will always be able to see errors in their error log.
and this is the response I get from them sigh
 
reveal_type, it's not actually a function. So you don't import it from anywhere
 
@MisterMiyagi and 2k files caused a problem? Or were there too many times 2k files?
I know if you create 100k files it gets heavy on inodes and file lookup...
 
12:50 PM
@aadibajpai lol, because some people can mess up things, we mess up things to to accomodate for their messup. Sounds like the software in the internet in general
and I found my issue: if __name__ == '__main__':
main() is ofc not being run when running with gunicorn. So my loggers were never set up
 
Please someone as look the code after edit2 stackoverflow.com/questions/62476758/tkinter-fix-scrollbar
If i create a window into scrolled canvas, when i scroll the frame inside the window still displayed.
 
1:14 PM
Currently, I've got a TLS socket connection setup.. however, one question I'm curious about is what is the recommended (if there is at all) recv() bufsize parameter? I've read in different places of people using anything from 1024, to 4096 up to 8192..
 
@AndrasDeak Yeah, for the actual middleware filelookup becomes the problem. There are anywhere from 150k to 500k files in a single folder. The middleware ends up being slower to detect new jobs (by an O(n) scan) than user/VO submission tools taking to submit, wait, 6h timeout and cancel a job.
I'm mainly just venting frustration at this point, and hopefully influence the greater programmer consciousness to avoid repeating such mistakes.
 
@rshah I use 1024, works fine
 
@rshah you may want to look at what is the configured network buffer size of your OS. 4096 is usually a safe bet if a bit ancient, though.
 
@MisterMiyagi Since it is a Java-converted-to-Python library from log4j, not surprising. Would be nice to have a new logging module that used Python semantics, or at least provided some reasonable defaults that log4j omits.
 
@MisterMiyagi it's just a curious question, as I'm going to be using mininet for TLS-based experiments on a SDN
 
1:28 PM
@Aran-Fey AFAIK it means that T will be some subclass of int. Notably, it means any T used in the same generic is the same subclass.
 
1:53 PM
brief cbg all
 
cbg
 
@MisterMiyagi Well, that depends on the variance, doesn't it? You have to replace every T with some class - if T is covariant, you can simply replace it withint everywhere and still allow instances of subclasses (boolor whatever)
 
What is your goal with your current project @Aran-Fey the typing stuff I mean
 
@MisterMiyagi yeah, that was clear, I was only curious
@MisterMiyagi nice
 
2:09 PM
@AndrasDeak Indeed. It's the kind of job security that is worth fighting tooth and nail to get rid of.
@Aran-Fey I would have said yes, but mypy says no. With all the grace and glory I've only come to know from C++ compilers.
 
*shakes magic 8-ball*...segfault
(I know that you mean compile-time errors)
 
@Hakaishin Well, I actually have multiple goals. I want to A) verify type hints at runtime, and B) have a backwards compatible way of looking inside typing classes, for, yet again, a number of reasons. For example, I want to take two function signatures and create an "intersection", i.e. a new function signature that accepts only arguments that both input signatures would also accept
 
@Aran-Fey You realise that's the way to building a compiler, right?
 
Is it? All I know is that it's incredibly difficult
 
Why do this in Python and not just use a language which supports types?
 
2:23 PM
I mean... even if I use a statically typed language, I still have the same problem
 
@Aran-Fey how, the compiler checks the types at compile time. So they should be correct at runtime no?
 
Well, not really, because the code I'm working with is too dynamic for that. I look at function signatures at run time and do different things depending on what I find
kind of like pytest
 
@Hakaishin In my case, working on something related behind the scenes, it's about wanting to understand how these things work. There's a lot to learn by building the complicated yourself.
 
@Aran-Fey can you give me an example why you would need that?
 
Basically I want to automatically create a command line interface for a function
@cli
def frobnicate(what: str, how_many_times: int = 3):
    ...

# $> my_program.py frobnicate hello 2
 
2:36 PM
interesting. Sounds super hard :D
but do you need types for that? I feel like I could built a @cli without types and it should work, no?
 
Well, if I don't automatically convert the arguments to the appropriate type then there's not much point :P
 
everything is a string in the command line
of course you could define a function in a way that explicitly converts, but that defeats Aran's purpose
 
Where it really gets interesting is when you have stuff like what: List[Employee]. Now you have to find out how Employees are instantiated, etc
 
Would that not be pointlessly complicated in the command line?
oh, you just mean [Employee('potato joe'), Employee('bob')]
 
why not just use any common formatting language like json?
or configargparser?
 
2:42 PM
JSON's not a nice command line interface
 
json would be way less readable/writable in the command line
 
Yeah I'm not thinking about the cli but about a file
 
he's talking about the cli
 
I feel like anything that get's complicated why do it over cli instead of a file/gui
 
Doing things over the command line certainly becomes sketchy if you have something like what: Tuple[List[List[Employee]], Dragon]. Don't ask what that function is doing with those arguments.
 
2:47 PM
so you're writing a command-line database interface ;)
 
dragon.execute(employees)
 
Wow... that seems a rather extreme disciplinary action :)
is that like, verbal warning, written warning, then DRAGON :p
3
 
Yeah, we've had a lot of success with that system - nobody has ever misbehaved again after their 3rd transgression
 
also no complaints from involved employees
 
3:07 PM
And probably very few from the executed employees either
 
I'm thinking of un-hammering this question: stackoverflow.com/q/40059654/4014959 My answer there has been steadily gathering votes over the years, so it's clearly been useful to a lot of people, and I think it deserves greater visibility. Although the dupe target question is a valid dupe target, the question (and my answer) are much more specific. Does anyone have any objections?
I'll preserve the link to the old target by posting a comment.
 
and convert single quotes to double quotes to make it valid JSON - works for the example but can see that breaking stuff...
 
@JonClements Fair point. But I also show a more robust way, using literal_eval.
 
yup... might be worth moving that to the top?
also, from what I recall, the demjson module is quite good at "almost" JSON data...
 
I'm not a fan of such questions. It's asking about 2 separate issues - converting bytes to string, and parsing not-really-JSON. And then it includes the solution to the first of those problems in the question itself. If it's reopened, it should also be edited into shape IMO
 
3:18 PM
@JonClements That's probably a good idea.
@Aran-Fey I'd prefer not to change the question very much. The OP kind of understood the difference between bytes & strings, but didn't realise that json.loads needs a string, not bytes. And that's a pretty easy mistake to make if you've just migrated to Python 3 from Python 2.
The current form of that question has allowed a lot of people to find it. I don't mind changes that improve its findability, but I don't want to lose people who'd otherwise find it.
 
arghghghh... I'm sure I've read this as well but can I think of an author/title...
 
3:42 PM
@JonClements Seems familiar. But my brain is currently overloaded with short sci-fi stories. Over the last few days I've been working my way through The Twilight Zone plot summaries on Wikipedia. :)
 
user13682510
cbg
 
umm... that sounds almost as risky as tvtropes when it comes to being a time sink :)
 
Almost. :) There are a lot of Twilight Zone episodes. I've read about 120 so far.
I've currently got 2 answers on the HNQ, 1 on SF&F and 1 on Astronomy. So the points have been rolling in nicely for the past 2 days, although neither have hit the repcap.
 
That should be a badge of some sort :)
 
Cross-site badges could be interesting...
 
3:54 PM
if I have:
def __init__(self):
    signal.signal(signal.SIGINT, self.exit)
    signal.signal(signal.SIGTERM, self.exit)
 
Speaking of HNQ, the CEO's Star Trek question on SF&F hit the HNQ, and he's scored rather nicely.
 
does that prevent other thingies to also get the sigint and sigterm signal? For example gunicorn? Because It doesnt shut down properly
do I need to reraise the signal somehow?
Well things are running splendid using supervisord :) Goal achieved, time to call it a day. Bye people
 
rbrb
 
user13682510
rbrb
 
@PM2Ring I saw that but I didn't notice the asker. Too bad he only left a single comment on that site. Probably no time for real engagement
 
4:10 PM
@Hakaishin You may find this helpful: unix.stackexchange.com/q/149741/88378 Generally, signals propagate from a parent process to its child processes, not the other way around. It would be weird for a child to send a signal to its parent, IMO. But I'm a little bit rusty on this stuff, so I may be wrong. :)
@AndrasDeak Probably, but it's nice he did take the time to contribute to the community-a-thon. I notice from his profile that he's posted a few answers on Space Exploration, and 14 on The Workplace, shortly before he became CEO (IIRC).
 
Assuming it wasn't someone from PR :P
 
Cynic. ;)
 
@Hakaishin Python only has one signal handler at a time. So if the "other thingies" are signal handlers in that process, then yes, these are prevented from running. Otherwise, no, each process handles signals on its own.
 
4:27 PM
@MisterMiyagi I'm not clear on his setup, but he was talking about Django earlier. So I assume he's got Python stuff that uses Django, running on a gunicorn Web server.
 
errr... wat?
@PM2Ring someone's answered it - not at all a name I was thinking of though :)
 
4:47 PM
@JonClements one of my highest voted answers, unfortunately, is on "how to make division by zero equal zero" ;_;
 
presumably the asker knew it was undefined but wanted to know how to set a default rather than be confused about why it did raise an exception to start with?
 
yeah, it was essentially the same as that question but worded much better
surprisingly popular topic
 
To be more precise, 0/0 is an indeterminate form.
@JonClements I'm familiar with the name of Gardner Dozois, but I couldn't name any stories he wrote. I think he edited quite a few anthologies of short stories. It doesn't surprise me that John Rennie knew the answer - I was going to say earlier that he probably knows. :) He's got an encyclopedic knowledge of sci-fi. I often chat with him in The h Bar, the Physics chat room (he's a RO), but we don't often chat about sci-fi there.
 
ahh... it's just quite nice to see something that Valorum hasn't answered :)
 
5:02 PM
@PM2Ring I'm currently reading a collection called Rogues he co-edited with George RR Martin. Some really freakin' good stories in there...
 
To be even more pedantic "It is not appropriate, however, to call these expressions "indeterminate forms" outside the context of determining limits".
Wikipedia says: "He was the founding editor of The Year's Best Science Fiction anthologies and was editor of Asimov's Science Fiction magazine, garnering multiple Hugo and Locus Awards for those works almost every year". So his name should be familiar, if you're into sci-fi of that era.
 
I swear there was a popular tweet about that a few days ago. This looks like a direct copy of that.
 
I saw a post within the last week
Hammered yam
Thanks, puppy
 
watermelon :)
 
5:46 PM
There was "weird cat behavior with braces" and now we have the sequel, "weird python behavior with colons"
 
It's news to me that x : int is a valid expression statement. I thought type annotations were usually contained within function headers.
I've spent ten minutes browsing through the language specification and I haven't yet found confirmation that it's legal syntax. And yet, my REPL executes it, so ¯\_(ツ)_/¯
 
@Kevin You need it if you have a container type that's assigned to an empty value foo = {}. So you can do foo: dict[str, int] = {} to give it the correct types
 
@Kevin You can typehint a variable prior to assigning to it.
 
That's fine, I don't have a problem with annotated assignment statements. Those are well documented, at docs.python.org/3/reference/…. But x : int is not an assignment statement.
Or, hmmmmmm
annotated_assignment_stmt ::=  augtarget ":" expression
                               ["=" (starred_expression | yield_expression)]
 
I thought [] denoted optionals. So it's right there
 
5:57 PM
Ah, so assignment is optional in an assignment statement. Makes perfect sense ( ͡° ͜ʖ ͡°)
 
lol
 
Vaultah said "the : is the assignment operator"
 
Devil's advocate: that's hardly the weirdest thing about the grammar. The expression 1, for example, qualifies as the following expressions: power, unary arithmetic, multiplication, addition, bit shift, bitwise and, bitwise xor, bitwise or, boolean comparison, not test, and test, or test
So I could just as easily "( ͡° ͜ʖ ͡°)" about how virtually every binary operator does not, strictly speaking, require the operator itself
Mercifully, most of this wackiness gets culled out of the AST before you can get your hands on it.
But now I'm curious. Why does annotated assignment make the assignment optional? To appease fans of C-style variable declaration?
 
I would presume if you need to declare the type before an if else but assign in the if else.
 
Sayeth the PEP: "Being able to omit the initial value allows for easier typing of variables assigned in conditional branches:". I guess.
 
6:38 PM
Umm. we must have a decent dupe for swapping stuff?
 
 
4 hours later…
10:35 PM
TypeError: name() argument 1 must be a unicode character, not str
not confusing at all
 
11:20 PM
goodnight cabbage
 
user13682510
cbg
 

« first day (3537 days earlier)      last day (1402 days later) »