« first day (2350 days earlier)      last day (2598 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
I try to pretend annotations don't exist, so I can't help you there
 
wim
you should just type everything like def foo(arg : Duck): -> Duck
 
But the question uses complete sentences which puts you in the top 10% of question askers, so that's worth an upvote right there
 
wim
I'm annoyed with the type-perfectionists
These questions are becoming more regular now. You can drill those things down as detailed as you like, but who is it supposed to help? Your IDE?
 
You just have to accept that if your function uses obj.bark, your user will pass both Dog and Tree objects to it.
 
Well I might be in the minority, but for me a statically typed python language would be perfect.
 
6:03 PM
Then it wouldn't be Python :(
 
It's not wrong to want that, I think. But it's not something that I want personally.
 
Kevin what kind of donation size would it take to implement that in KevinScript?
 
Especially if it wouldn't use "oop" types but rather something like "contract types" (IE: "this is an object that has __getitem__, __str__ and my_function defined in it)
 
wim
you do that you end up with java
 
@MooingRawr Sounds like a pain to implement, so... Enough to pay the salary of a contractor to do it for me.
 
wim
6:04 PM
it's a contradiction to want that in python
and writing annotations that you don't use for anything, talk about a big waste of time. test coverage is the way to ensure quality / prevent bugs
 
Annotations could then make code better self-commenting (in a way an IDE could even understand) and at the same time allow some static checking.
 
^ agreed. Annotations could be replaced with better comments, but those are too rare.
Document when and what your function throws, agh!
 
wim
disagreed
if I pass you an object that i know behaves like a dict, but it fails your dict type check, that sucks
 
def count_something(input: typing.Sequence) is much clearer than having to either look through a documentation or through the function itself. - It's a way to "formalize documentation".
 
wim
and it's none of your business the internals of my custom objects
 
6:07 PM
Isn't there a "has getitem and setitem" ABC?
 
If I want the user to know a parameter should be a sequence, I usually do def count_something(seq):
"Yeah, well, that's obviously a simple example," you hypothetically say. "If it's a real complicated function, what do you do then?" in which case, I just don't write complicated functions :-P
 
Still that's not a formal description - so the user either has to understand your naming scheme or you have to define that in a documentation. - It's the formalizing that I like, just like I actually LIKE pep8.
Funny how Europe and the US (and rest of the world I think) seem to actually move in opposite directions with regards to this.
 
6:24 PM
for the parents out there with little ones.
 
wim
6:51 PM
can we lock relationships at the schema level?
e.g. suppose you have an Author with a many Books , and if author.status = 'deceased' you don't want to permit any change to the collection of author.books
 
If your RDBMS supports CHECK constraints, sure. But it probably doesn't.
 
wim
I can do this at the code level, of course, but curious if it is also enforceable with schema
 
Oh, that wouldn't be a constraint. That would be a trigger
I don't know if triggers count as part of the "schema", but if you want the check done at the database level, it's probably possible
 
wim
will look into triggers, thanks
 
user6845426
7:10 PM
Any OpenCV wizards here
 
> you do not need to say “anyone here know Django?” before asking a question about Django. Even if you do, the Django experts in the room might not step forward until hearing the actual question. They may not wish to commit themselves to help until they know how much effort it will entail.
 
wim
they didn't ask about Django, they asked about OpenCV ... ;)
 
dipper you have been here long enough that you should know the rules by now :( I am sadden now :(
 
I'm a wizard
 
user6845426
I'm sorry. I feel like I've failed you all.
 
user6845426
7:14 PM
Bad dobby
 
Hufflepuff 4 lyfe
 
wim
any room rules nazis here?
 
I would like to think I remind/inform people of the room rules. If you want to break them because my guilt trip/suggestion isn't strong enough, who am I to stop you... I'm no room owner :D
 
If you want to get maximally pedantic, it's not a "rule" that you can't have a "anyone know X?" preamble. I'm just quoting our handy guide that indicates why such a query might be met with stony silence
 
user6845426
I have a scanned document containing x many lines of text. I want to be able to separate these lines into individual images to apply further wizard magic. Anyone know a good approach?
 
7:24 PM
I just got 3 upvotes, and one downvote for a simple answer. I wish downvoters would leave me feedback on what I can improve on :\
 
user6845426
haterz
 
but I feel if I ask them for it in the comments I would not get a reply, since they might be long gone (it's happen in the past) :( guess I will never know
Oh it might have been me miss typing sample with shuffle, even thought my link to the docs is to sample, and my example uses sample :\ guess I deserve it should have proof read it better .
 
Perhaps they object to your use of the variable name generate_random_names, which, despite being a verb clause, is not a function. Yes, I know OP used it first, but some drive-by downvoters don't think that's a valid excuse.
Personally I try to keep naming conventions as close to the OP's orginal code as possible, even if doing so violates style standards (... To a reasonable degree)
And I've gotten dinged for it a couple times.
 
valid point, but then would op get upset if i use different variable names. I just wanted to link it to OP's so there's little to no confusion :\ but then it's confusing for future readers
I understand :\ what to do what to do....
 
Cant make everyone happy. Especially random Internet people.
 
7:30 PM
That's why I try to make random Internet people that I get to talk to every now and then happy, more than I try with random random people :D
I wonder if I put generated_random_names would that please both parties. It's close to OP but it's still correct for new readers...
 
Could be, could be
 
wim
def generate_random_names():
    # yield something
generated_random_names = True
random_names = [...]
 
Dear language devs, please permit question marks in variable names so we can mark boolean values like generated_random_names? = True
 
is_generated_random_names = True :D
 
wim
7:45 PM
maybe you want the ruby room
 
Is that a thing in ruby? That's kind of hilarious.
 
wim
foo.curious_method?
foo.exciting_method!
yeah, I think the convention is that methods ending with a bang! modify the object in place
and I forget whatt the question mark is about
but it sure makes reading the code interesting
 
Top google hit says, "A method ending with ? should return a value which can be evaluated to true or false"
 
135
Q: What does the question mark operator mean in Ruby?

rtacconiWhat is the purpose of the question mark operator in Ruby? Sometimes it appears like this: assert !product.valid? sometimes it's in an if construct.

It's just a coding style, looks like ? is a valid character for variables =O
 
7:48 PM
Silly nonpython languages, having values which are neither true-y nor false-y.
 
> neither false-y nor true-y
MFW..... reading this comment :D
 
user6845426
My only light just blew. Great.
 
user6845426
I forgot to eat my carrots too
 
wim
in the currently accepted axioms of mathematics, you can make these statements that you can prove are impossible to prove, and you can also prove they are impossible to disprove
the "other" bool :)
 
7:53 PM
re-cbg
 
how do you pronounce 'Gödel's' ?
guu-dell-s ?
 
Go-Dell
 
wim
hmm I thought it's more like "gerdell"
 
@poke might be able to help
 
wim
girdle
 
7:56 PM
Trying to remember how to pronounce an O with two dots over it... I know some people spell "cooperate" with an O with two dots over it, so maybe an O with two dots over it is pronounced like the O sounds in "cooperate".
So it would sound like "go - odel"
 
en.wikipedia.org/wiki/Kurt_G%C3%B6del wiki has a pronunciation section...
 
wim
that says it's like i had
like "herd" or "nurse"
 
Or maybe I'm thinking of an accent mark which looks similar to, but is distinct from, an O with two dots over it, and which means "this pair of O's makes two sounds even though two O's together usually just indicates a long O"
 
wim
is there an accepted way to make a helper function available on pytest module?
I know I can put a fixture like that in conftest.py
@pytest.fixture
def helper():
    def the_helper():
        print("I'm helping!")
    return the_helper
 
I pronounce it as Gödel
 
8:03 PM
so...helpful.... Andras... >.>
 
#latin2
 
wim
then the test would be like
def test_thing(helper):
    helper()
 
#3meta5me
 
wim
but I would prefer to register the helper and have this kind of interface
 
wim
8:03 PM
import pytest

def test_thing():
    pytest.helper()
 
Gödel, I meant #2 but I suspect most Germans say it more like #1 (Gödl)
 
wim
8:46 PM
>>> from textwrap import dedent
>>> s1 = dedent('''\
...     blah
...     blah
... ''')
>>> s1
'blah\nblah\n'
>>> s2 = dedent('''\
...     blah
...     blah
...     ''')
>>>
>>> s2
'blah\nblah\n'
is that expected behaviour?
or bug
s2 seems correct
s1 seems contradict docstring of dedent
 
If I have a class that is a wrapper for an API and this class has a public method GetCategories() which performs an API call and returns a list of categories..

Should I wrap the API call in the method with a Try Catch and return an empty list if there is an excepton?
or should I not catch any exceptions so that the exception bubbles up on its own to the user of the api class?
 
quick question for who are avail
let's say I have this dictionnary
mycat = {'size' : '2fat','color' : 'gold' , 'disposition' : 'whispering'}
I know I can do something like this
('big cat '  'is ' ''a moron)
 
(but why would you?)
(go on)
 
and I want to do this
('My cat' mycat['size'] ' has fur')
But I have this error
 
just use string concatenation or compatible options
 
wim
8:54 PM
use f-strings
 
your original is a string literal
 
 File "<ipython-input-7-5e5d267920dc>", line 1
 
wim
f"My cat {mycat['size']} has fur"
 
DSM
Aw, man, I was about to drop the modernism. :-P
 
or 'My cat' + mycat['size'] + ' has fur' (just proof of concept)
you can use string formatting or f-strings
I never know whether string concatenation is better for stuff that are already strings
 
8:56 PM
wait checking with my tor browser what is f string
 
wim
@AndrasDeak that's so lame, grandpa
 
back in my day we allocated char arrays and even set the null terminator by hand
 
wim
but you'll need python 3.6+ to shave that supersize furry pussy
 
To summarize: implicit string literal concatenation – 'foo' 'bar' == 'foobar' – only works with string literals. mycat['size'] is not a string literal.
 
f-strings will almost always be the best choice because space can be precomputed. Second-best would be str.format or ''.join()
 
8:58 PM
f-strings are the best choice because they force you to use up-to-date python
 
wim
...unless you're logging
 
when using the f string, it gives me an invalid syntax ...
 
1 min ago, by wim
but you'll need python 3.6+ to shave that supersize furry pussy
ignore the second half of the sentence
 
wim
then you want logger.thing("My cat %a has fur", mycat['size'])
 
%a sounds nice and fortrany
who's the grandpa now?
 
wim
8:59 PM
logging module is the grandpa
because it was copied from java weenies
 
java weenies and their java beanies?
Yeah let's not
 
@ZeroPiraeus fortran is not my native language so I'll believe you
 
Note: do not google.
 
wim
lmao
 
@wim you sure? I've just piped logger
and there was no such thing as thing ...
 
wim
9:01 PM
political correctness wins again
 
hmm
weird, but OK
I'll go back to thing
 
@Kevin apologies; no offence was intended.
 
wim
thing is a placeholder method because I don't know how urgent your pussy's fur is
maybe logger.info ??
logger.too_much_info ?? :D
 
welp im off, have a wonderful day :D \o rbrb -go leafs :D-
 
thanks @ZeroPiraeus
learn a new thing today
need to update the python prompt I have
for the F stuff
 
 
1 hour later…
10:17 PM
Oh man, that feeling you get when you add some bit of functionality to a module, thinking it might some day later be useful, and then twenty months later, it's actually overwhelmingly useful. :y
 
heh:)
good job, past Augusta
 
Good work recent-past Augusta, for remembering it was there instead of duplicating it. <_<;
 
that too:D
 
rp!A has totally dropped the ball on that before so this is important.
She really needed this.
 
10:35 PM
Hi
 
helo
 
It's possible to unhide webelement(click) without selenium webdriver?
click on element
 
10:56 PM
Hm.
 
Hey, anybody have a favorite cross platform audio library? I want to play a ding when my script is done :-)
 
Code edits to questions are almost always rejectable, but are code edits to answers kosher?
 
11:18 PM
@Augusta depends on the specifics
if the original was clearly wrong, then possibly, yes
but I'd first try pinging the answerer in case they're still active
in the end it boils down to the taste of the reviewers that find the suggested edit
with a lucky streak of robo-reviewers anything can go through
 
00:00 - 18:0018:00 - 00:00

« first day (2350 days earlier)      last day (2598 days later) »