« first day (4332 days earlier)      last day (840 days later) » 

05:01
Good morning All...I am new to this room. I have a query. Can it be feasible in python that

System should automatically record Equipment uptime and downtime
 
2 hours later…
06:41
@ShutterSoul I don't understand what you're asking. Is this related to python at all?
 
4 hours later…
11:07
Feasible? Sure. Would I use Python for to do it? Probably not, but it depends on what you mean by "System" and "Equipment".
11:21
If anyone manages to find a np.searchsorted dupe, this basic question should be closed stackoverflow.com/q/73499702/9698684
12:02
Hello python-fans. I see "foobar" a lot of times. Does anyone know where it comes from?
;
The terms foobar (), foo, bar, baz, and others are used as metasyntactic variables and placeholder names in computer programming or computer-related documentation. They have been used to name entities such as variables, functions, and commands whose exact identity is unimportant and serve only to demonstrate a concept. == History and etymology == It is possible that foobar is a playful allusion to the World War II-era military slang FUBAR (Fucked Up Beyond All Repair).According to an Internet Engineering Task Force RFC, the word FOO originated as a nonsense word with its earliest documented use...
That is a combination of two commonly used metasyntactic variables. en.wikipedia.org/wiki/Metasyntactic_variable in layman's terms "we don't really know what to call this and it doesn't matter anyway". Origin is down the Wikipedia rabbit hole.
"[one possible origin is] related to the Chinese word fu ("福", sometimes transliterated foo, as in foo dog), which can mean happiness or blessing." Oh good, so I've been infusing my programs with blessings this whole time.
A computer is sand that we have tricked into thinking. It might harbor a grudge about that, so one ought to placate it with offerings.
[It was all Perl? / Always was].png
Positive energy is especially important, to balance out the negative energy of electrons
12:13
Allow me to be pedantic and say that No sand has been tricked into thinking, but some sand has been forced to retain information.
I will allow this pedanticness
Hahaa, thank you deeply.
You know I must have learned by heart the Tao of Programming, thanks to you. Probably my favorite essay in the whole world.
Well not by heart, by heart. But the main ideas.
To add an additional parallel thread of pedanticness, I'm pretty sure silicon makes up the green part of the microchip, which current does not typically flow through directly
You want the copper-colored parts for that
(confidence that this was ever true for commercial-grade chips: 70%)
Information is kind of a weird concept. Strictly speaking, doesn't sand always retain information? (That information being "There is sand here")
Makes sense. Atoms have charge and mass and such, and each of those values are a kind of information.
12:20
Human-origin information, perhaps? But then, that would also extend to grains of sand that have been stepped on.
"There is sand here" gets hazy at the atomic level, what with the uncertainty principle, but "there is sand in this general area, with 99% likelihood" counts as information I think
This ties back into the information density/entropy thing from the other day. I vaguely recall reading about how you could, in principle, turn information into energy directly. I didn't understand any of it.
The device that is commonly referred to as computer is just sand that has been forced, through manufacturing, to retain information originated through electric pulses.
foobar comes from an expression (first?) appearing in World War II - FUBAR. It was an acronym for F***ed Up Beyond All Recognition.
Oh, it says that in the wiki article. Oh well, it's true...
We know from the other military acronym, SNAFU, that everything being F'ed up is a familiar, comfortable, neutral state. One might think of foo as a serene acceptance of the world's chaotic nature
I never have been a fan of ('foo', 'bar'), I use ('yo', 'mama') wherever it would not be problematic.
And 'yeah buddy', instead of 'hello, world!"
12:29
I occasionally use "zort", and its reverse, "troz". I believe it's a nonsense word from Pinky and the Brain.
Excellent reference. 'yeah buddy' is from some character in Rick & Morty, iirc
For a nonsense verb I like "reticulate", which comes from the nonsense message "reticulating splines..." that appears during loading screens in SimCity and The Sims
And frobnicate, which I simply lifted straight out of the Jargon File
I occasionally use 'ranginate' and 'ranginator'
13:05
I honestly use whatever. Sometimes I use weird ones like "gah" or "wow" or even "meow".
other times, it can seem like I have an existential crisis, and use "me" or "you" or even "them".
13:52
The phrasing "I honestly use whatever" gave me the idea of using valley girl talk as placeholders which in turn reminded me of something I learned of recently jon.how/likepython
14:06
Currently reading a tutorial on working with a particular API. A few paragraphs in, it says, "This is where the app ID and secret key you noted earlier come into play." This is the first time that "app ID" and "secret key" appear in the document.
The secret key is so secret that even the instructions for finding it are secret
They're on double secret probation.
I found the instructions in another tutorial elsewhere on the site. How quaint that the author thinks I'm reading everything in order.
We async baby
async baby We.
14:25
baby, be async we must
15:20
@0x263A interesting. That reminded me of something I looked into a couples of months ago, osmosian.com, which is partially hosted on github, github.com/Folds/english, and for some example of it: quora.com/profile/Gerry-Rzeppa is the author's quora
they called it "plain english" and it's windows only
Initial impression is "Oh look someone reinvented COBOL" which was (partially) designed to be easy to use by English-speakers and borrows constructs from the English language.
if you don't like quora, there much more details on the fasm forum: board.flatassembler.net/topic.php?t=18031
yeah, some people on most forums said the same thing
other compared it to pascal or fortran
16:04
Can someone give me some advice on this. I replied no, because I have never seen a callback function return anything that can be used later on, but can it really return something?
It's pretty rare for the return value of a callback to be accessible later. Ultimately, it's up to the code that's managing the callbacks.
So it is possible?
Hmm interesting
As far as Python is concerned, a callback is a regular function in every way.
From my perspective the answer to "Is foo possible with baz" in programming is never really "No." it's more like "No. Unless..."
16:14
to me, it's more like "Everything is possible" which also encompasses "Everything is impossible", because, If everything is truly possible, then it also has to encompass impossibility and vise-versa. Also adding "it depends" into it make the blessing work better
all of that, only specifically when it comes to programming
If everything is possible, then how come everything is not possible
it's because they are each their own limits. For the "everything is possible", it's as described above, but for the reverse, it's more like "if everything is truly impossible, then it's impossible that there is no way to do X"
it's easier to just say "it depends" I guess
@NordineLotfi Very much :P
Poking through the tkinter code... When the user clicks on a button, the tk engine notifies tkinter, and tkinter calls the callback, and hands its return value back to the tk engine. I don't know what the tk engine does with it, if anything.
@0x263A I use this hipster language generator for my lorem ipsum needs as well as when I'm just bored.
16:20
The tk docs don't say, and I haven't yet perused tk's source code
My advice, don't :P
16:51
Silly workaround
import tkinter
import functools

class ReturnSaver:
    def __init__(self):
        self.last_saved_return = None
    def monitored(self, func):
        @functools.wraps(func)
        def f(*args, **kwargs):
            self.last_saved_return = func(*args, **kwargs)
            return self.last_saved_return
        return f

saver = ReturnSaver()

@saver.monitored
def clicked():
    return "foobar"

def idle():
    print("Most recent return value of clicked:", saver.last_saved_return)
    root.after(100, idle)
I worry that the OP of that question would look at this code and say, "no no, I don't want to see the return value while I'm inside idle. I want to see it right after I call tkinter.Button(root, command=clicked)." This is a problem, because right after tkinter.Button executes, the program has been running for about one millisecond and the window isn't even visible to the user yet. It's logically impossible to know what the callback is going to return a trillion CPU cycles into the future.
17:08
Re: "[the name of the callback is the] name of the function and the memory location I assume". You're right. Here's how tkinter decides the cbname of a callback:
def _register(self, callback):
    f = CallWrapper(callback, None, self._root).__call__
    cbname = repr(id(f))
    try:
        callback = callback.__func__
    except AttributeError:
        pass
    try:
        cbname = cbname + callback.__name__
    except AttributeError:
        pass
id(f) is the memory location of the function's CallWrapper, and __name__ is the function's name. __func__ only applies to methods of class instances.
 
2 hours later…
19:29
Wow, that must be some ancient compatibility code. Methods have had a __name__ attribute, for... well, a while
19:40
I noticed that one when I was on ipython once...didn't know it was ancient
 
1 hour later…
20:58
In GTK, you can return a value in your callbacks, but (of course) that value isn't returned to the caller.
Jun 5, 2019 at 23:03, by PM 2Ring
@AndrasDeak True, but it depends on the framework. In GTK, callbacks for event handlers can return a bool to indicate whether they successfully handled the event. If the event wasn't successfully handled, the event gets passed up to the parent widget.
That allows multiple widgets in a hierarchy to respond to the same event. It's similar to how exceptions can bubble up, until some handler proclaims "the buck stops here".
21:24
In chat.stackoverflow.com/transcript/message/55129066#55129066 I mean the callback's return value isn't returned to the place where the callback was passed as an arg.
21:59
Right, because when you pass the callback as an argument to another function, you aren't calling it

« first day (4332 days earlier)      last day (840 days later) »