reason why I won't do hats is because I can't help but delve down into the pits of awful shenanigans in order to get me my hats. I had the most hats of anyone else on SO circa 2016 (not SE). My worst offense was creating my own tag and tagging 50 of my own questions with it in order to get a silver badge adn the associated hat. I remember relaying this story here before as a testament to my debauchery. JC said something like "You know I can see that, right?"
I'm not proposing this but this is where my mind goes. We can identify a question currently sitting at zero. all three of us downvote, then answer, then remove downvotes, then upvote and hope to get plus 5 on the answer
hypothetically... if all 3 people dv'd, then answered the question, then uv'd, would all 3 get the badge? Or perhaps the hat has a way of discounting your vote so you cannot influence things?
@wim do don't sort, for starters. For the size of the numbers involved here, it is otherwise perfectly servicable. Rosetta Code has a few more options: rosettacode.org/wiki/Factors_of_an_integer#Python
hello , i'm trying to add data to a table with sqlalchemy were 1 function will add half the column and another function will cover the rest for example x = {id=id , v=v } and in another function z = {id=id , b=b } the table look like this {id , b , v } whenever i try to insert z or x i get an error because i've not provided value for the 3rd item , how can i do this ?
is there a canonical way to set classes as "non-boolean"? Using __bool__ = None as for __hash__ produces a rather unhelpful TypeError: 'NoneType' object is not callable
@PaulMcG oh you are right , i actually have some renaming and saving destination codes which I've excluded them because it's not necessary but i've accidentally left out important stuff as well , I'll fix it.
@za001a I guess not - where do methods stop and start? If this really is how your code is indented then you have bigger problems. If it isn't then why are you posting this confusing mess of text.
It looks like you are fairly new to SO, but please consider the people who you want to read your questions. If you won't take the time to carefully post your problem code, why do you expect them to take the time to sort it out?
@MisterMiyagi things that don't have a hash raise an error if you try to hash them. So whatever doesn't have truthiness should raise in their __bool__.
def __bool__(self):
raise TypeError('I refuse to guess if I'm true or not')
@PaulMcG I'm fairly new to coding and that's how my code look like right now , not sure why you are saying this but i'm doing my best to make it as clear as possible
should I add the Javascript part . is that what you mean ? @PaulMcG i'm trying not to add too many noise stuff that might confuse others from zooming in on the real issue.
Well, what else could there be? It can return True, or False, or...something else that is either truthy or not. You'll have to support things like if your_obj: ... where a truthy or non-truthy replacement would choose either way
which means that the only option is not returning anything, i.e. raising (also, in the face of ambiguity refuse the temptation to guess)
I need to learn some more about teting and how to mock out stuff for tests, does anyone have any thoughts on pytest vs unittest, bearing in mind I haven't looked at pytests' fixtures yet?
Hi Andras. I'm ok, I guess. :) It's taken me a bit longer than usual this year to get over my usual winter depression, but my mood seems to be improving.
object.__bool__(self)
Called to implement truth value testing and the built-in operation bool(); should return False or True. When this method is not defined, __len__() is called, if it is defined, and the object is considered true if its result is nonzero. If a class defines neither __len__() nor __bool__(), all its instances are considered true.
Oh, good. :) But anyway, if it's totally forbidden to call bool() on the object then IMHO an Exception of some kind ought to be raised. And I guess TypeError, or a subclass of it, is appropriate.
OTOH, I totally agree with ThiefMaster that such an object is non-Pythonic, so MisterMiyagi better have a yamming good reason for creating such a thing. ;)
Somebody recommended me wing yesterday. I am trying to open a remote project but it somehow can't open folder it is looking for some project file on the remote, but I don't get how to create it, any ideas?
A few days ago I discovered Alex Kasman's Mathematical Fiction database. "This database lists over one thousand short stories, plays, novels, films, and comic books containing math or mathematicians".
That database has some great stuff. But sadly, many stories written by non-mathematicians portray mathematicians as asocial, or socially inept, or downright evil. :( Alex (the maintainer) often complains about that. He's written a few stories himself that avoid that stereotype. I've only read one of his stories (so far), but I hope to read more of his work.
Mods don't generally have to handle NAA/VLQ flags... (there's some cases where an NAA flag jumps straight to the mod queue instead of the community queue - accepted answers for instance) but generally the community reviews them (mods don't by default see anything in that queue that's less than an hour old) - mods just pick up any slack pending.
@timgeb If an answer looks so bad that it could've been posted by a bot, then you can flag it as a possible spam precursor, with a custom flag. But if it's merely technically wrong, then it should be handled by the community.
@timgeb yeah... however, it's still an "answer" - be it completely wrong or an answer to a different question... the NAA flag is used to indicate what's in the answer box is a comment/doesn't contain an answer otherwise kind of thing.
@Hakaishin I don't know anyone who uses Wings IDE - let alone anyone that'd recommend it... think I've installed it and tried it once and just immediately got turned off...
@timgeb so NAA is basically: "could you provide more information about what x is?" or "I'm having the same issue - did you ever solve this?" - should be a comment... "look at <some link here>" - no content in the answer itself even if the link does answer the question...
I think PyCharm is pretty much the go to IDE these days if one wants to use an IDE?
oh... so it goes to levels beyond what I was expecting then... (probably should have read a bit more on it before commenting :p) @Arne - sounds cool though... not something I'd use but cool none the less...
@Arne when Eclipse originally came out - I was actually really quite hopeful about some kind of universal IDE... but then, spending a few hours with it (mostly waiting for it to do anything) and then trying to grok what it expected of me to do be able to do anything configuration wise etc... I left it be...
nah, it's slow fullstop. There are only four or five users here and it's brutal at times. We obviously try to keep everything automated with terraform or whatever, but sometimes you can't help being in there, and ugh
Wasn't any slower or faster at OldCo, which had a couple of hundred on
@Arne yeah... it seemed fairly monolithic - while what I was excited about was potentially for extending it and modularity for things... that err... didn't strike me as ever really happening...
I was expecting it to be a fairly light ide framework with plug and play stuff - not a behemoth that it ended up as...
@Neo re.findall is a little different to doing a basic re.search, which is (probably) what your regex tester does, but I haven't used any online regex testers in ages.