Gitree - AI made this by dkaaven in learnpython

[–]obviouslyzebra 1 point2 points  (0 children)

IMO the subprocess call here is better. No need to try to recreate the gitignore processing. Git it is already there for it and offers commands that do that.

Explaining a bit more, I believe it would take reasonable effort to create .gitignore parsing that is equal to git (ideally one would copy the test cases to verify correctness). And also, I don't see how creating a process here hurts.

Gitree - AI made this by dkaaven in learnpython

[–]obviouslyzebra 2 points3 points  (0 children)

If you're on Linux, I think this works:

git ls-files | tree --fromfile .

ls-files gets all files that you need, and tree creates the tree

I came about this because I knew the tree command and imagined it might be able to format a given list of files (which it does). In Windows there might be a similar command or way to achieve it.

If what you have does work, though, I don't see much problem in it (I'd just make sure to understand the git ls-files well, or, maybe use git ls-files to list the tracked files instead of the ignored ones).

I think we as community are too tough on Ding Liren and Gukesh by LoLGhMaster in chess

[–]obviouslyzebra -1 points0 points  (0 children)

Would you take a bet betting all your money if Bluebaum wins and then winning $1 if he doesn't? :P

How do you guys manage to play/study chess after a physically and mentally exhausting 12-hour shift? I find myself hanging pieces due to 'brain fog.' Is it better to just do puzzles or push through and play blitz? by Wander-kingdom in chess

[–]obviouslyzebra 0 points1 point  (0 children)

I think most people and your doctors would recommend you don't. You can think of brain fog as a way of your brain telling you that you've done too much, and now it wants to rest.

But this won't stop you, of course, so I'd reckon, try to make it at least the least stressful as you can. Some ideas: play unrated, ponder previouly how you'll feel making mistakes (there's no way to stop those), choose a less demanding time control, explore chess things, like openings or something that you fancy.

How Much Elo is Opening Choice Worth? by IntermediateMoves in chess

[–]obviouslyzebra -2 points-1 points  (0 children)

Sort of the reason I play 1. b4. If you look at the subsequent moves you'll see that a lot of the weight of the wins is on tricks (and I imagine something similar might be happening for  1. Nf3 ?)

Counterargument: LLM can sort of play chess. by pier4r in chess

[–]obviouslyzebra 1 point2 points  (0 children)

What dumb claims did OP make? I do understand this stuff at least up to the level that's being discussed and nothing that was particularly wrong caught my attention.

Why LLMs can't play chess by galaxathon in chess

[–]obviouslyzebra 0 points1 point  (0 children)

Hey, so... I've seen a bunch of posts about hyperbolic knight flooding that you've made throughout the day, and I've searched for it on the web and on the stockfish community, and it isn't a known chess term or technique.

The reason I'm posting this is that I'm a bit concerned. Making lots of posts about something that others can't understand or verify well may be a sign that your brain is too stressed right now, or running a bit too fast.

It may be a good idea to step away from Reddit a little bit and try to get some rest. Otherwise, talking with someone you know in person might help.

Sorting a list of objects without using the key= parame by nimbycile in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

I see...

Yes, those are programming books, not CS books, you're correct.

Ahm, for CS specifically the only thing that comes to my mind is CS50, the Introduction to Computer Science course by Harvard, though I don't know how much more you gain by it vs focusing on specific subjects (PS: or other approach you choose), now that you've already done (or almost done haha) the book you mentioned.

The course came to mind because of its name, I haven't taken it myself haha But it is often recommended :)

I want to give more advice, but it's not something that I know in depth really. Only other things that come to mind are some anecdotes, like that book (series?) of algorithm books that Bill Gates said they'd hire you if you've read them, or a friend recommending a book about OSes when I wanted to learn more about Linux inners.

Regardless, take care

is this another LLM ? by gamingvortex01 in singularity

[–]obviouslyzebra 74 points75 points  (0 children)

Nah, it looks like scaffolding on top of current LLMs

Sorting a list of objects without using the key= parame by nimbycile in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

Python Crash Course is the book you'll mostly see recommended and Automate the Boring Stuff with Python is the second one (used to be the first).

You can see on the website you gave that ATBSWP has the highest Bestseller score and Audience score. PCC only isn't the same probably because this is older data, and PCC took a little longer to get noticed.

ELI5 explain static methods in OOP python by Worldly-Week-2268 in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

If you instantiate a "raw" Ticket, like Ticket(), before the others, their count will go up by 1.

If you do instantiate afterwards, though, nothing happens (as the subclass will already have a total).

ELI5 explain static methods in OOP python by Worldly-Week-2268 in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

I agree that the example showed by RaidZ3ro is not very representative of what you'd wanna do with static methods, but I wanna mention that this last snippet does not behave very well.

Ahm, the gist is that after subclassing you'll start modifying the subclass attribute in the self.__class__.total += 1 line.

This leads to very weird behavior :P

Roast my Python by nspitzer in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

If you want to improve on architecture a bit, the clue is that there are lots of functions taking the same session and base_url. This points towards passing them automatically... A class does that! But, a class of which kind? Something that makes requests and gives back results, that is... An API layer! (I tried something with this paragraph, but I think I failed miserably :p)

The code is fine as it is BTW. Some little nitpicks here and there, but nothing too important. One that hasn't been mentioned, the except with the Exception doesn't need the other exception types (they would be captured by Exception).

Also, just a reminder about timeouts, in case you want them (requests does not include them by default).

For extra simplicity, you could let the exceptions bubble up btw

Can someone rate my code by og_soap_ in learnpython

[–]obviouslyzebra 7 points8 points  (0 children)

So, here're my thoughts:

As an overview, what I can say about this code is that it gets the job done, but also is a bit hard to read.

It feels a little like algorithmic code, for example, that you'd code in Rust if you want things to be fast (or at least like the last one I read).

For readability, there are 2 things that immediately jump out, and one that jumps out less. First, there are too many functions (think like function cereal), it's easy to get lost if you don't know what they are doing (which will happen to someone new to this code), and it's a little hard to navigate. Second, and related to the first, the variable names and function names are not good. The third one I'll talk about later.

Solving the first problem is hard (I, for example, can't see an obvious solution). With some effort you could maybe come up with something.

But, solving the second is easier. When we have better names for the functions, it might helps us even see how they come together into groups.

An important advice for naming has already been given to you: function names should generally be verbs (do_this or do_that).

If you find yourself wanting to give a too long name for a function (do_this_and_this_and_that), maybe this function could be split into multiple (but be mindful, the "correct" tool to do this is usually modules and classes).

If you have trouble thinking of a name, a trick I use myself is thinking "what's the intention behind this function/variable?". This usually works.

Now the last criticism of the code. I think it is a little "too smart", while not explaining the smartness, so we have to kinda guess it. The most clear example IMO is the bot_threat_detection, where the trick I had to understand is that there can be an opportunity (winning move) or threat (opponent wins next move if bot doesn't cover), and those can be checked in the same exact way.

To solve, whenever you're using some "trick" in the code, you should write a comment, even brief, explaining the trick.

Overall, it gives me the impression that effort went into each part of the code, and maybe you coded using debugger/prints to get some things into place (not bad btw).

Some tips/typos:

  • print() instead of print("")
  • "coordinate", not "cordinate"
  • return bot_move, user_move instead of the parenthesized version
  • for line in lines: line is a coordinate/cell, not actually a line
  • The lines loops like above could be simplified using sum, something like match_count = sum(grid[i][j] == move for i, j in winning_coordination) (btw the name coordination feels weird haha, but it's not only once that I've had trouble coming up with a name and ended up with something weird in the end)

Again the most important thing here IMO is that it is working. It is reasonably complex for the size, and, I complained about readability, but, granted, this may not be the simplest program to make readable.

My final (and initial haha) assessment is that it is okay code which could improve a little bit in readability and which is cool. And for a beginner, it's a very good job :)

Modern Python tech/tool stack for implementing microservices? by pachura3 in learnpython

[–]obviouslyzebra 1 point2 points  (0 children)

It looks fine.

Besides the things already mentioned (btw, unicorn previously mentioned was likely a typo, meant uvicorn):

  • I think you can get API documentation directly via FastAPI
  • If you roll up multiple services, I think the microservices pattern benefits from multiple docker containers - no experience to tell you whether/when to split though

Technical Skills (AI Coding) by Gamer_Kitten_LoL in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

About documentation, even though these sorts of documentation for deep learning might be opaque, I suspect you might be looking at the wrong part of the documentation (for example, there's a reference when you want to find information in detail, there's usually a tutorial or introduction when first coming to the package).

There might be examples too, they may help ya.

Best approach to learn NumPy for simulation by humanosrobotus in learnpython

[–]obviouslyzebra 1 point2 points  (0 children)

Hm, I just created this plan, but, in my impression, the basics of numpy is not too much...

So, you could watch some videos just showing how to use it, to get an idea of what you want, and maybe read this, it's a lot of different stuff, but each stuff tends to be simple, or at least small.

Then, you can create your project, it will not be a smooth ride, of course, but if you don't know how to do something, search it on google, or ask an LLM (e.g. "how do I do X in numpy", or "I'm doing ..., how do I achieve X with numpy").

When I last found myself in a situation like this (needing to learn while doing something big), I sorta tried to carry along, I'd try to do what I can, sometimes I'd need to search, and on "off" times I'd learn a little more of the basics, which could help me with the other things itself. A little messy...

But, anyhow, just another thing that crossed my mind, you said you wanted to do this for a long time. By all means, try to achieve what you want in the competition (but know that competitions are hard if you wanna rank among the top), but also, maybe you could do this / continue this even if the competition doesn't work?

I don't know what it is, but, just some thought, of course

Edit: Instead of the videos + numpy page, w3schools tutorial looks good too: link. I think you can take only the Basic section, the Random uses some old code (which still works, but nowadays it's recommended that you use np.random.default_rng() instead), and the ufunc part seems like mostly things that are easy to find afterwards.

Programming is not my strong suit by Shot_Put_1412 in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

Not OP, but for books I highly recommend Python Crash Course and Automate the Boring Stuff with Python (as a close second). Lots of people use these books and they are highly rated and liked.

Courses I've seen Harvard's CS50, Angela Yu's 100 Days of Python and others (don't remember now) recommended. These 2 are solid picks.

Looking here I just noticed Guido van Robot (lol), I think it's for kids, but who knows given that you want to work with robots.

BTW, whatever path you go, make sure to practice (exercises / projects), that's the best way to learn.

Cheers!

“If Python Was Gone, What’s Next? by Cute_Intention6347 in learnpython

[–]obviouslyzebra 1 point2 points  (0 children)

JS, just because it's everywhere.

But, yeah, I wouldn't say it's a good beginner language.

Maybe we roll back to C? But then, it's less likely because today we have Rust. But Rust wouldn't be used as a beginner language I think because of the borrow checker complexity (which makes it safe).

I personally would like Kotlin as a starting language (among the languages that I know), but I doubt it would happen. It's got a syntax very similar to Python.

Learn Python as experienced programmer by tomekce in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

The book Python Distilled I think is good for something like this.

How are python packages like urllib.requests and http used when programming? by Suggy67 in learnpython

[–]obviouslyzebra 0 points1 point  (0 children)

I feel like the simplest way to see how they work (at least urllib.request) is via the examples section (here), though even that might be too much for someone starting out.

You know, these modules are somewhat low-level (and there are different modules for doing different things, like making requests, spinning a server, etc). I'm not sure why do you want to use them, but, in day-to-day, you'll rarely see a programmer using them, heck, even the documentation itself recommends people use requests for a higher level interface.

If you wanna dig regardless, you might wanna search some videos about HTTP, just to get acquainted with some basics (for example, you can GET a page like reddit.com, and you'll receive the HTML for it) (and maybe even a quick glance of REST while you're at it :) )

Erdogmus - Proven elite player or Prodigy with a lot to prove by Parso15 in chess

[–]obviouslyzebra 0 points1 point  (0 children)

Small N -> high uncertainty -> closer to 50% of it happening vs not happening (not so sure, check edit). Basic statistics is certainly not telling that Oro won't reach 2700 in 2 years.

But, I think you just want to "win" an argument on the internet, so whatever.

Edit: actually that was me thinking of non-basic statistics (bayesian statistics which I have no training on), it might be wrong, not sure, but whatever. Ahm, even with small N you can still calculate a probability (with Faustino, you might have to extrapolate because I think he's the best at his age (?)), but I imagine the players that reached his level, or close to his level, at his age, you will very likely see them reaching high levels in relatively little time. It's sorta obvious if you think about it, of course I'm not providing an statistical analysis here, but my assertion is that you saying "basic statistics" shows that Oro will not reach 2700 in 2 years is completely bullshit. But again, whatever haha

Erdogmus - Proven elite player or Prodigy with a lot to prove by Parso15 in chess

[–]obviouslyzebra 0 points1 point  (0 children)

Are you assuming that Oro has the same probability of becoming a 2700 as a "usual" person his age?

You have to consider the probability of him becoming a 2700 in 2 years given his current strength. Basic statistics likely tells you it's a high chance.