« first day (3693 days earlier)      last day (1255 days later) » 

2:34 AM
@Kevin hmm, seems that firefox' tracking protection broke the site. Not sure, because turning it back on again doesn't re-break the site.
 
 
3 hours later…
5:49 AM
how can i make my own GUI library from scratch?
 
I guess that is a huge thing to do
 
ok then how can i make a browser engine from scratch?
is there any documentation to it?
any links?
 
not sure if this is just me, but both these ideas are huge, you can with some effort make a browser with an existing GUI framework
 
is there any documentation in html and css rendering
on html and css rendering*
and js
 
6:34 AM
@Praveen I think you've asked this a few days or a week ago. Usually people start with projects that are in or near their grasp, and that they can visualize the steps they would take to get there. These are all not-small projects, usually built by teams of people.
Your question is kind of a puzzle on several levels. Why are you doing such an ambitious project? If you were skilled enough to do it, you would not be asking how to start? Why are you asking to start if you don't know how to do this?
Is there maybe a smaller project you could start with?
But you won't really get many answers here. It would be like walking into a hardware store and saying "I want to build a 50-story skyscraper, how do I start?"
5
So you asked these questions, can you at least say why this is a project you want to take on?
 
my guess is for resume? assuming he is looking for jobs, I would be happy if I can have a such a project so early in my career
 
This happened last time too. He asked the question, we asked for more background, and then he left.
 
maybe he dont want employer or school finding out, giving the benefit of doubt, two strikes
can anyone tell me how the following two approaches differ? I cant figure out even after printing parents, its an algorithm that returns the path from root to leaf in a binary tree
def path(node,parents=None):
    parents=parents or []
    if node is None:
        return
    if node.left is None and node.right is None:
        yield parents+[node.data]
        return

    # this does not work

    # parents.append(node.data)
    # yield from path(node.left,parents)
    # yield from path(node.right,parents)

    # this works
    yield from path(node.left,parents+[node.data])
    yield from path(node.right,parents+[node.data])
I wrote both these code, and I am saying the third and fourth yield from works because it passed all test cases, idk how appending before hand gives different results
 
You have a list, parents. You pass it into path(node.left,parents). That function appends a value to parents. Then you call path(node.right,parents) with an incorrect parents value.
 
6:51 AM
tysm Aran, that makes sense
 
7:17 AM
@andra
@AndrasDeak @roganjosh Finally found the right sprint demo video: should be publicly available at drive.google.com/file/d/12qR8VQwsYoxAP7end1aXGMgrhM7xKkJQ/…
 
7:34 AM
that seems cool
I will try to do something like that, if you dont mind, not sure how easy it is though
 
7:59 AM
how to send text massage to mobile phone/whatsapp using python ...
 
@NabiShaikh Twilio has python libraries.
There may be other providers, but AFAIK, Twilio is popular and well-supported.
 
@shad0w_wa1k3r thanks ...is it free . or need to pay
 
it's paid, but comes with a trial I think. Don't think you'd find any providers with free WhatsApp messaging, SMS may be possible.
 
or else can we do email free with python ?
 
@NabiShaikh again, depends on the provider of the email service. It's not specific to python.
 
8:18 AM
@shad0w_wa1k3r lets say gmail .....is that free ?
 
@NabiShaikh I really don't know which use case you have in mind. Depending on the use case, it may or may not be free.
 
@shad0w_wa1k3r ok thanks ...let me figure it out .. basically i am having a model in traning mode . i want to convery my self phone if error happens ..
 
e.g. If it's programatically sending emails via your own account for personal reasons, yeah, gmail might be free. But if you plan to send it for business purposes, you'll have to find a provider because there is a lot about sending emails that is better covered by articles on the web, than me.
@NabiShaikh In your case, you can try sending via localhost, since there's only one but a reliable receiver - tutorialspoint.com/python/python_sending_email.htm
 
8:36 AM
How do I physically find a client who is sending garbage requests to my dns? Advanced ip scanner gives no info besides microchip technology inc.
 
@python_learner Why would I mind? I recorded that particular session from Google Meet, but I'm still looking for a better way ...
 
:), didnt want to be the guy who steals ideas
 
@Hakaishin You don't. You aren't the police :-). I presume this is on your LAN (where you ARE the police).
@python_learner Why not? Besides, it's hardly my idea: the sprint demo is a standard agile practice.
 
@holdenweb correct :)
 
I will start working on it, if things go well I will link it here then
 
8:40 AM
@Hakaishin Is it raising any other IP traffic? Maybe the nature of that traffic will clue you in as to the type of device?
 
Good idea, let me install wireshark on the dns
 
user3064538
can someone please rollback this edit replacing l's with t's, I don't think it helps stackoverflow.com/posts/952952/revisions
 
user3064538
sorry if this is not the right place to ask for this
 
@Boris I don't think the edit hurts even a little bit. On the contrary, it is somewhat useful, and the reviser put the justification quite clearly. Also, this is the Python room, so it's okay to request or review such an issue.
 
seconded, you should never use a single l as a variable name. It's a good edit.
 
8:58 AM
@holdenweb haha ofc since I started wireshark the events and the weird dns requests have stopped. Well gotta check another time it comes back.
 
Hi everyone
I am facing an issue while reading a text file using pandas
So the context is that we used to pull some data using some commands given in the Apple guide which returns some text files on a daily basis
The read_csv command we were using worked perfectly till a date but after this date the contents are not getting converted properly
let me share a link to how one the files are coming after calling read_csv in a pastebin link
please help if you can and please let me know if there are additional things I need to provide in that MCVE
 
9:16 AM
right now this is a datadump. We would need, input, expected output and what you tried to help you
 
it is there I guess
testFile = pd.read_csv(config_obj.get_downloads_data_dir() + '/' + files[0], sep='\t')
I am guessing, his problem is with this line
 
9:34 AM
@Hakaishin Typical! But if it's bursty, set a capture filter on the MAC address and leave it running? Gives you a better chance of catching the burst ...
@RaphX Apple Developer Support should handle this. The fact that your program stopped working on a certain date lets you ask them "What's changed in your data format?"
I'm not sure why a random group of Python people should start debugging the data format. I presume you can guarantee your program build was stable through that period and that you can examine change logs to verify this? If so, and if Apple say "Why, nothing changed" then you have a problem.
Until then, you have a minor inconvenience ;-).
 
9:51 AM
thanks @holdenweb
 
10:14 AM
Hello everyone. I'm trying to pip install a library (earthpy), but I receive the following error, in which I don't understand anything. Any help is appreciated, thank you.
On Ubuntu I have already installed that library but I don't seem to be able to do it on windows
 
10:32 AM
@PaulMcG i wanted to make gui library, where people can code in html and css
so i wanted to learn how a browser engine works
that is why i asked about any documentation/s that could help me
@John try using python 3
 
10:50 AM
Already tried
Same result
 
why does my flask app needs this decorater on top of my usual decorator to run ?
@app.route('/') ## dont runs without this why
@app.route('/login')
def login():
    return render_template('login.html')
 
11:10 AM
@John You might want to start by upgrading pip, as the error message recommends.
 
I just tried as you suggested. The newer version is successfully installed but it still says that I have the previous version
and it shows that warning again when I pip install earthpy
 
FWIW, your issue appears to be this one: github.com/pypa/pip/issues/8438
 
@Praveen - you will need to start with a parser for whatever input format you wish to use as your starting point. Since HTML is just a special dialect of XML, you could use one of the XML parsers that comes with Python, lxml or elementTree. For CSS, I see a couple of parsers on PyPI that you could install. Then comes the hard part - rendering the parsed data into the UI. For that you will need a UI library, like Qt or wx.
Once you learn the UI library, then you can get down to writing the rendering engine, which takes the parsed bits and uses the graphics library to render the text and images. You could start by writing a renderer for a small subset of HTML, like the <UL>, <LI> tags (and their corresponding </UL> and </LI> tags). Then add <OL> and <P> tags.
Then consult this list to see what remaining tags you have to implement. Then do the same for CSS.
 
@real_hagrid /login is an absolute path, so mapping starts from the root of the web tree - i.e., the web space has to be rooted?
If you don't know where the root is, where's anything else?
 
11:27 AM
@PaulMcG yeah ok
 
@real_hagrid it'll work just fine if you open a browser and go directly to 127.0.0.1:5000/login or something... but obviously you do want a / somewhere as a home page for when someone goes directly to the site... you probably don't want that to be the login route though...
 
11:59 AM
Hello, how to convert decimal number 7 to the Base64 index table's Char column's value(en.wikipedia.org/wiki/Base64) using python? It should print char 'H' for 7 according to this table.
 
If I have to evaluate the list [2, <built-in function mul>, 3, <built-in function sub>, 4, <built-in function add>, 1] should I do all those "Expression Tree" concept to get the actual result 2*3-4+1? was answering a question on main and thought about this
 
@owgitt make a string with those characters, and then index into it
>>> import string
>>> (string.ascii_uppercase + string.ascii_lowercase + string.digits + "+/")[7]
'H'
@python_learner Assuming that this list has already addressed the precedence of operations, you can just evaluate it by taking the first element and store as value, then take the function-operand pairs in the rest of the list and for each do value = function(value, operand) When you are done, value has the answer.
 
I guess ascii_letters gives both
 
@python_learner Do you want to evaluate it properly by respecting operator precedence, or head/tail first? Doesn't matter in this case, but could make a difference in general.
 
@python_learner But in the wrong order
 
12:12 PM
in this case it doest matter, but yes, I want to respect the order (operator precedence)
context : stackoverflow.com/questions/65003636/… trying not to use eval here
 
@python_learner We've crossed the streams here, so to clarify - ascii_letters has lowercase values first, but the Base64 list has the uppercase characters first. That's why I had to build it up that way.
 
didnt notice that
 
Yeah, I tried ascii_letters too, but got 'h' for 7, when it should be 'H'
As for evaluating arithmetic strings (infix notation) without using eval, if you want to handle precedence of operations there are recursive parsing or Shunting Yard algorithm. You can't just work left-to-right unless allt the operators are the same level of precedence and are left-associative.
Check out the plusminus module I wrote for doing this.
 
cool, will check it out
 
@PaulMcG Awesome! Thanks a lot.
 
12:24 PM
The intent is to provide a safe alternative to eval. But in the question you cited, they said they are a beginner and want to learn how to do this task (which is a little advanced for a beginner, but not bad if they have already done it in another language and want to learn how to do in Python). Just calling the plusminus version of eval is probably not going to teach them much.
 
yeah thats true, its not a beginner problem if not using brute force, this reminded me of the Matrix Chain Multiplication problem taught in class
idk why, felt kinda similar in my mind
 
If you can limit it to just + and -, and single digit operands, it's not too bad for a beginner.
 
I remember writing this brute force code for an old game which had you solve this exact thing, but with limited range, game was called Santa Something
 
12:53 PM
I have been using flasks config to store things which I need in routes, it feels like I'm misusing it as a global storage and I'm not sure if there is a better practice.
@app.route("/insert_into_db/<foo>/<bar>")
def insert_into_db(foo, bar):
    conn = app.config["conn"]
    c = app.config["c"]
	c.execute("INSERT INTO table VALUES (?,?,?)", (datetime.now().isoformat(), foo, bar))


def main():
    conn = sqlite3.connect('example.db')
    c = conn.cursor()
    app.config["conn"] = conn
    app.config["c"] = c
 
yeah, that's a misuse allright
 
how would I get access to the conn without creating it in the route every time and without making it global?
 
why not make it global? if your application is not too complicated, that's usually an ok thing to do
 
@Arne then I'd rather put it in the conf, it's the same. And what if my application gets complicated, then I don't want a global conn.
 
but it already is global, just in a weird way
there is a lot of value in making things obvious
 
1:11 PM
that's even more wrong
you must not use the sqlite cursor in many threads IIRC.
 
is an app running in multiple threads still "simple"?
oh I get it, the config is bound to an app-context?
Still looks like a verbose way to write g to me
 
yeah app is app = Flask(__name__) and I run it using this threading.Thread(target=app.run, kwargs={"host": "0.0.0.0", "use_reloader": False}, name="Foo server", daemon=True).start()
 
wat why?! :D
 
why not? That's how I usually start my flask apps
I tried to use gunicorn but was running into very annoying issue I couldn't solve, and I didn't encounter the issues when running the default werkzeug server like this
I always hated those debug messages like don't do this in production this is debug. I'd much rather prefer it if they told me, feature a,b,c doesn't work because it's not important for debugging but it is for production. Or there is this security risk with the debug server but not a production one. Then I atleast can judge myself if I can continue with werkzeug or not and if I need feature a,b,c, but right now it seems perfectly fine for me
also using flask run like in the quickstart docu I can't just use the pycharm shortcut to run the server. But is there an issue with starting it like this, which I just haven't encountered yet? Or is it just unusual?
 
1:34 PM
cmd
 
@Hakaishin it's not like certain features don't work, flask's builtin server is just not very good
If you find out that it has a serious security vulnerability and wrote an issue in flask's github, there is a good chance the maintainers will just tell you they'll fix it "maybe someday" while you're sitting on hot coals. If you had instead used a server that claims to be "production ready", they would probably tackle something like that asap
just to spell it out, flask is a web application framework, not a server. The builtin server is a convenience tool, nothing more.
 
@Arne In what way? That's again just a generic statement: "not very good". In my experience it is even objectively better than gunicorn, because I had 2 issue I couldn't solve after hours, which I never even had with werkzeug. And yes that comes probably from the fact that to be production read you need more setup and have more quirks, because you need to consider more things. But I use flask mostly as a way to make a gui for something not to make website which are available in the internet.
yeah, I'm talking about werkzeug
Because tkinter is so bad and the gui can atleast be accessed from an internal company netwrok
 
well, I can't tell you in what way the flask-dev server is lacking, I never deployed it in production because I just trusted the maintainers that I shouldn't
 
Plus running flask like this I can run it in pycharms debugger and set break points, very convenient. Don't see the problem with it on the contrary
 
oh, you should absolutely use the dev-server during development. just not for production.
 
1:49 PM
Yeah I trust the devs too that there are good reasons, but I think their reasons are based on the most common use case, which is to use it to deploy a website. And I guess it would be work to think about those assumptions and actually compare their dev server with some production server. But then again it could be high level like can't do proxy shenanigans, no security, can't do advanced caching and so on. And then if I see oh neat I don't need these features I can't simply use the dev server :)
Any ways rant off, it's just a warning and I shouldn't care that much about it
 
otoh you could use waitress for both debugging and production
 
Is there a way to just right click a python file and run waitress? Because In the doc it says I should do: waitress-serve --call 'flaskr:create_app' which seems inconvenient. But ofc if I ever go online with something I wont be using werkzeug but a production wsgi, but not gunicorn, thanks for the tip, I will try waitress next time
 
@cs95 It didn't happen.
 
waitress you need to be careful with your configuration if you've got blocking calls - you've got N worker threads and beyond that no more will be spawned
I am not sure how flask is currently wired... I think you'd need to run something behind if __name__ == '__main__' guard or sth.
 
@AnttiHaapala Don't all python programs use that guard? I never wrote one without it, except if it's 5lines long, but then it's easier to just use the console quickly
 
2:02 PM
but yes, waitress works as a library too, so you can write something like
from flaskapp import app
waitress.serve(app, port=8041, url_scheme='https')
 
ah awesome :) Thanks, I will also check out flaskapp seems nice
 
2:23 PM
morning cabbages folks
 
 
2 hours later…
4:12 PM
Hey everyone, I want to create a class which inherits from dict and add a method x to it. However, in future Python releases, dict might provide an x method which other methods rely on. This would break my class. (My x method would still be available, but other methods from dict can't use the new x but only "see" my x.) Did I get it right so far? Is there any design choice should I make to prevent this from happening?
 
I'm not sure what happens, but I would assume that calling x.foo() would call the "closest" foo available, so if it exists on your class it calls that and if it doesn't it calls parents foo. But that is a wild guess and how I would like things to be, no clue if things are like this. But I'm sure there are ppl here who know the answer
 
@finefoot I think that's mostly correct if you're not talking about dunder methods. Since you can't see the future, not sure what you can do. Perhaps have some tests that ensure that you're not shadowing existing attributes.
 
@AndrasDeak This prints child for me and if I remove child foo it prints parent. So it shouldn't break right?
class Parent:
    def foo(self):
        print("Parent")

class Child(Parent):
    def foo(self):
        print("Child")

child = Child()
child.foo()
 
@Hakaishin it "breaks" in the sense that Parent.foo which is a completely different method than Child.foo is shadowed by the latter.
 
Ah nvm, he edited the thing in braces in
 
4:27 PM
@Hakaishin Yes, I added some clarification. Sorry for the confusion.
 
I'm so stressed, I'm practicing coding challenges and i sucks at them its taking me hours to solve them, I'm afraid I'll fail yet another coding assessment :(
 
I can't imagine that dumb coding challenge problems are representative of good coding interviews
 
i hate working in those stupid browser ide where i have to use print statements to debug
 
@AndrasDeak You mean something like if getattr(dict, "x", None) is not None: raise RuntimeError("not compatible") in __init__ of my class?
 
@finefoot no, there's no point in running checks like that for every instantiation. You'd have a test suite, which lets you know when a new python version breaks your class (or vice versa). So you don't release a new version until you handle the clash.
 
4:31 PM
@AndrasDeak you'd be surprised, all the ones i've had so far are basically clone questions of various online assessment sites. Plus what really pisses me off is I have 10 years work experience and so far the coding assessment has been the single barrier at every single company I've applied to
so I feel like all my experience in other areas counts for nothing and I might as well have dedicated my lifes work to just algorithmic problems in order to get a job
it depressing really
 
@erotavlas I said "good" coding interviews
If I were given dumb coding challenge problems (especially of the "haha, this is really easy if you know this one math trick" kind) I'd reconsider wanting to work at such a place
 
@AndrasDeak Okay, thanks. On that scale, it makes sense. For smaller scripts, without full-on test suite, is the general design advice to steer clear of those issues and to better not inherit from classes that I have no control over when they might change? I could always just use the dict as an attribute in my class instead of inheriting.
 
i had only one really great experience where I coded on a whiteboard and the problem wasn't like those online ones, it was more representative of work the company actually did, I was able to solve it and explain my process as I did
 
@erotavlas ideally the only thing that matters is how you approach the problem, for which even dumb coding challenge site problems can be useful. I just wouldn't expect them to be ideal.
@finefoot I can't say anything definitive, I'm not very good at design. Others can probably pitch in later. But I'd think that built-in classes only extremely rarely get new non-dunder attributes, and then it's unlikely that you'd see a clash. So the question is that if there's an unlikely clash in the future, are you OK with your users having to update their code before updating your library.
 
@finefoot Generally, YAGNI comes to mind. Don't overthink this one, as long as inheriting makes sense you're fine to inherit and make your own attributes. Trying to future proof your code this way doesn't really sound worth it at all. You might as well just declare inheritance off-limits because the parent "may or may not change"
 
4:41 PM
e@AndrasDeak Yah I suppose, I totally get having to know those things like graphs, trees, time complexity etc, I guess I'm just frustrated because these are things we deal with in a very small percentage of daily work so you become out of practice. Then when you are hit with a question it's kind of a shock to the system. I just have to keep practicing.
 
@finefoot The only thing that might possibly help is sharpening up your psychic powers. Short of that just prefix your names with mypkg_ or similar.
 
@AndrasDeak 👍 Got it, thanks :)
@ParitoshSingh Was just wondering about this. But yeah... I need to apply YAGNI a lot more in my life :P
@holdenweb Yeah, however prefix mypkg_ isn't really pretty either. But I get it, I thought about that, too.
I'm just gonna leave it as it is. ;) For bigger projects, I'd rely on a test suite. Thanks everyone for the input.
 
Hi! Can I use the random function to randomize certain functions? I would like to shuffle my functions something like that? Pls help tysm :<
 
4:57 PM
Yes, you can use the random function to randomize the order of functions, or the behavior within a funnction.
 
How?
 
Put your functions in a container, and choose randomly from that.
Assuming you're asking "how do I randomly choose one function among multiple functions?"
 
quizOne = quizOne()
quizTwo = quizTwo()
randomList = random.choice((quizOne, quizTwo))
 
@annyeongkre don't call the functions; those first two lines will break your code
 
like this?
 
4:59 PM
just something like the third line
 
okay let me try i hope it work
tysm
 
when you say quizOne it already refers to the function quizOne, assuming you have def quizOne(...): ...
 
Say a, b, and c are methods that can be run in any order. Create a list of them, shuffle the list (which uses random() internally), and then run them.
functions = [a,b,c]
random.shuffle(functions)
for fn in functions:
    fn()
 
remember that after you select a function at random, then call it.
 
@annyeongkre and the result from that will not be a list, it will be a single function.
 
5:01 PM
Or to just call one, use random.choice as listed above:
 
randomList = random.choice((quizOne(), quizTwo()))
 
If you really just want to shuffle them, use something like what Paul showed.
 
like this?
 
fn = random.choice(functions)
fn()
 
@annyeongkre no :'(
 
5:01 PM
then call it?
 
@annyeongkre "call it" means "put () after its name". So you shouldn't put () before shuffling. That would call the functions prematurely.
@annyeongkre have you read a good python tutorial yet?
 
Yes, it's important when creating your sequence of functions, that you not use ()'s Note that the definition of functions I created just use a, b, c, not a(), b(), c() - big difference!
 
if my functions are quizOne() and quizTwo(), this is how will i put them? -->
functions = [quizOne, quizTwo]
random.shuffle(functions)
for fn in functions:
fn()
?
sorry im just a newbie in python :(
 
Yes. This will call both of them, but sometimes quizOne first and sometimes quizTwo first.
 
@annyeongkre please see our formatting guide for chat and practice in the sandbox. But yes.
 
5:08 PM
omg thank you so much :(
 
@annyeongkre that's alright. But you haven't answered my question: have you read a good python tutorial yet?
 
not yet hehe
not that much yet
 
@annyeongkre Hehe. You really should. These are fundamental things in python (difference between a function and a function call, for instance). Which is fine not to know, but you should use a tutorial to build a fundamental understanding of the language. We can help with the rest.
 
noted, thank you!
 
6:06 PM
Hi guys, I wondering if there was anyway to add to system path using python, like i have an exe and i want to add it to system path using python. I found out about sys.path but im not sure how to use it or if its the proper way? Any ideas?
 
6:37 PM
sys.path is not the system path, confusingly. Think of it as the Python (system) path. It does not affect the OS's search for executables but Python's search for modules/packages.
 
So any other way this can be achieved?
 
The system path (known to its friends as $PATH) is in the process environment, which you can access as os.environ. I'll leave it to others to tell you whether that will do you any good ...
 
@CoolCloud You can only add directories to the PATH, not specific executables
If that's what you want, you can modify it by executing setx PATH "C:\myfolder;%PATH%"
 
The best way forward is undoubtedly to learn about virtual environments. This is a bullet I refused to bite for far too long, I am ashamed to confess.
If you look at sys.path you will find a site-packages directory. That's where pip installs things. Virtual environments set up a private site-packages directory, so pip installs things in the virtual environment, which is in your filestore and therefore does not require special permissions.
Try python -m venv --help
 
@holdenweb Oh i see
It makes sense now.
I asked for it cuz i wanted to add a directory to system path on a friends pc just using python, so they dont have to go and do it by themselves.
 
6:49 PM
But none of that helps you with finding an executable, for which you'll either have to modify %PATH (sorry, didn't realise you're a Windows user) or move the executable into a directory already on it.
Ah well, now you talk about distribution ... potentially an even more difficult subject.
 
Hmmmmm distribution with python has always been a headache xp (for me)
 
FWIW, "append to PATH" is a task I would do with the shell, not Python.
 
can i jus simply append to path using setx? i havent heard about it. Are there any things i should be concerned about? Safety or permanent errors?
 
7:33 PM
it's very likey fine, but impossible to promise
 
 
1 hour later…
8:40 PM
@CoolCloud you know that setx truncates the path, right?
512 characters, if my memory serves
Why? I don't know. I've borked my PATH in the past trying to get around annoying IT restrictions.
 
Wait, for real? I had no idea. Yammin' Microsoft -.-'
 
Ah, 1024 characters. Depends how much stuff/what you've installed as to whether that approach will cause issues
 
hooray for arbitrary and uncomfortably small limits
 
No kidding. And given that the whole reason I was using setx in the first place was to avoid waiting for a week on a support ticket with IT.... it was doubly-fun to explain why my PATH was broken when I finally did have to raise a ticket (since it cannot be undone and it was my only avenue to change the path in the first place). 0/10 would not try it again
 
It probably doesn't even return a nonzero exit code, does it
 
8:54 PM
Error code? <hearty laugh> It doesn't even give a warning about what it's going to do. It just tells you after it's done it
I suppose, technically, it gives "WARNING" but it's already done at that point. I don't know whether they changed that mess but I certainly won't be testing it
Ah, sorry, I misread "exit" and "error". You're correct. It assumes it did its job good n stuff
 
Is there a difference between exit code and error code?
I guess technically 0 isn't an error code
 
I'm not so sure tbh, but I realised I'd misread you regardless and assumed you knew there was a difference so corrected myself :)
 
9:22 PM
does anyone know of a way that I can get the individual parameters of an operator.itemgetter? If I have g = operator.itemgetter(1,2,3,4), I'd like to be able to do print(magic(g)) to give me back (1,2,3,4). Any thoughts?
 
is the g being used in a different scope? Why not use the arguments that were passed?
 
yup, I'm getting g from a different scope
 
Well, if all else fails...
>>> class IdDict(dict):
...  def __missing__(self, key):
...   return key
...
>>> g = operator.itemgetter(1,2,3,4)
>>> g(IdDict())
(1, 2, 3, 4)
 
yeah, that'll work... but I'd really rather not have to hack around dict
 
Other ideas include...
>>> g.__reduce__()[1]
(1, 2, 3, 4)
Okay, I lied, that's my only other idea
 
9:34 PM
aha! that's exactly what I was looking for. Thank you
 
you could also parse repr(g) ;)
 
no more string parsing for me. I hate that yammer :P
 
9:48 PM
Happy smurfing @Aran-Fey. How's the experience so far?
 
10:46 PM
@JasminParent I'll move that message, please repost that with nicer phrasing
 
11:02 PM
@AndrasDeak fun fact, that is in fact the "sane" location. I don't even know how to grok the request (intentionally vague due to rotated knifing)
 
I think the moving was due to the language being used, not the context
 
yes, I thought that was obvious
 
Seemingly not. Anyway, kittens or puppies?
 
are we talking politics now?
 
I think that Monty, my cat, harbours ambitions to take over the world and have every meal completely open to him. Is that political?
 
11:17 PM
Only if I have to denounce kittens in favour of puppies :P
 
I think there's only one real way to decide <thinks back to the 90's Gladiators show in the UK>. They need to be perched on tall platforms and bash each other with giant cotton buds. I think that's how democracy works; then you don't need to denounce anyone
 
that system is rigged against poor pacifist puppers, blatantly favouring the militant felids
 
<taps nose>We'll see. Good luck at the polls....
 
user6568562
11:37 PM
Cbg, everyone
 
user6568562
Does anyone use youtube-dl here ?
 
11:49 PM
if I have a recursive function in a class, do I have to pass self to it in the recursive call? example

    def dfs(self, adj, vertex):
        self.visited[vertex] += 1

        for next in adj[vertex]:
            dfs()
 
@erotavlas 1. you'd want to use self.dfs(...), 2. you'd have to pass adj and vertex to that function call if you want to see something other than an error.
Recursive functions are hard. First understand them without the additional burden of classes.
 
yeah vscode was complaining,

    def dfs(self, adj, vertex):
        self.visited[vertex] += 1

        for next in adj[vertex]:
            self.dfs(adj, next)
 
user6568562
I was wondering myself, what kind of class method would need to be recursive ?
 
i was just writing depth first search on graph, i just happened to write it as a class method
 
sorry, I misread the last line
 
11:56 PM
its just visiting, i haven't added the part that keeps track of which vertex has already been visited
oh wait I did, nvm
 

« first day (3693 days earlier)      last day (1255 days later) »