« first day (2834 days earlier)      last day (522 days later) » 

5:38 AM
1
Q: How to get the nested key vale of yaml data?

rowocNeed to print the key and value based on jobid for each role. database.yaml --- company 1: role 1: post:[eng,dev] jobid:[1101] status:[active yes] role 2: post:[sql,c] jobid:[1102] status:[active no] comapny 2: role 1: p...

 
 
2 hours later…
7:46 AM
1 message moved from Python
 
database.yaml

---
company 1:
    role 1:
        post:[eng,dev]
        jobid:[1101]
        status:[active yes]
    role 2:
        post:[sql,c]
        jobid:[1102]
        status:[active no]

comapny 2:
    role 1:
        post:[qtm]
        jobid:[na]
        status:[active no]

Should able to print the data based on jobid: [1101] as a sentence mentioned below.

status is active yes if jobid is [1101] from role 1 in company 1
 
1 message moved from Python
 
8:08 AM
database.yaml

---
company 1:
    role 1:
        post: [eng,dev]
        jobid: [1101]
        status: [active yes]
    role 2:
        post: [sql,c]
        jobid: [1102]
        status: [active no]

comapny 2:
    role 1:
        post: [qtm]
        jobid: [na]
        status: [active no]

Should able to print the data based on jobid: [1101] as a sentence mentioned below.

status is active yes if jobid is [1101] from role 1 in company 1
I had tried the code below but it just printing all the status of each role

import yaml

def find(d, tag):
    if tag in d:
        yield d[tag]
    for k, v in d.items():
        if isinstance(v, dict):
            for i in find(v, tag):
                yield i

stream = open('database.yaml', 'r')
data = yaml.load(stream,Loader=yaml.FullLoader)

for val in find(data, 'status'):
    print(val)
 
8:23 AM
2 messages moved from Python
 
 
11 hours later…
7:29 PM
0
Q: Typehint Union Dictionary branching error

Wanting to be anAndroidDevelorI want to implement a function like the one below, but it throws a type hint warning. def test(flag: bool)->Dict[str, int]| Dict[str, str]: a: Dict[str, str]| Dict[str, int] = {} if flag: a['a'] = 1 else: a['a'] = 'hello' return post_process(a) I know the followi...

 
1 message moved from Python
 
 
3 hours later…
10:02 PM
@MisterMiyagi Man type hint has made Python so verbose it's ridiculous
And my OCD is telling me to fill out every type hints and fix every type hint warning
this is not healthy, maybe I should turn it back off again
 
10:17 PM
I can't get over the fact they released type guard without the implementation of the negative case
 
@WantingtobeanAndroidDevelor yes, additional Information takes up additional space. More news at 5.
 
Like can you even hint multiple return types as of now?
I.e.
a: int, b: str = 1, 'hello'
Like this is just no longer Pythonic I'm sorry
why not just go use a statically typed langauge like dart?
 
Can't that be simplified to result_batch: Iterable?
 
I mean maybe you could but I dont want to
because later along the code you check if it is a Tuple or actually an Iterable
 
I think it would be nice if you didn't use images to show code, just saying :)
 
10:26 PM
Someone was complaining about it before but I totally do not see any issue
especially when I'm trying to highlight how much of a pain the type hint warnings are
and you know why run(*input_batch) is showing warnings?
Ya because there are no good way to type hint variable input variables I.e. *args
It's so ridiculously and broken
 
Well, without any context the warnings don't tell me anything
 
Like, that warning should just be suprresed with # type: ignore
 
All I can tell from that screenshot is that you're writing Iterable[Any] instead of Iterable for no reason
 
Like they are just trying to parse return tuples of a function
Python automatically convert multiple return variables into a tuple
But when the guy who implemented the function just returns a single variable, it doesn't convert it to tuple
 
I don't know, I feel like we talked a lot before about how x,y,z type hinting is. Don't get me wrong, I do have things to complain about when it comes to type hinting, but they are useless to voice anyway, and would just unnecessarily flood the chat.
 
10:30 PM
that is what I am trying to communicate to the developers reading the code
Ok I agree pleaase just delete the comments on the rant including the images
Its just floods
 
I'm not saying that's what you're doing, I was talking about myself
 
And I'm not confortable with just codes I ve touched floating around chat space
 
Does that mean you're done with your rant?
 
Is there a way to delete images here?
Yes, except not really but yes
 
@WantingtobeanAndroidDevelor hm, perhaps not everyone can decide on a whim what language to use? Or could it be that there are more considerations than just one WIP feature in isolation?
@WantingtobeanAndroidDevelor it’s completely unreadable on the light mobile view. Just looks like a black box.
 
10:33 PM
Like, as a developer all I care about is my use case and that should be considered fair
 
I mean, you need to take into account everyone else use-cases too. Unless of course, it's your own fork/tool/version, then it's fine
 
As soon as a language is not fit for use case just because they want to support some extreme nich type hint use case in numpy, sacrificing ergonomics for my use case, I have the right to complain right?
 
Why here?
 
We didn't write the language
 
10:35 PM
That's why I asked to delete the images
 
@WantingtobeanAndroidDevelor like, as a developer I care about my users use case. And they want to write Python and need tooling support for hand holding.
 
? I don't know what you are trying to say
 
they're saying the same thing I tried to say: you need to take into account others use cases too.
 
@WantingtobeanAndroidDevelor how does type hinting sacrifice ergonomics? You are free to literally ignore it completely.
 
Guys do I have to break the rules to delete the links or something? Someone else removed my link earlier why can't I remove them my self lol
@MisterMiyagi The current implementation of type hint hearts my ergonomics
 
10:38 PM
I could move them, but it now takes my effort. You said what you wanted to say
 
E.g. the fact they still have not implemented Type Guard negative case because of some numpy people complaining about something I don't quite get
Ok, please?
 
@WantingtobeanAndroidDevelor well, how? You have to write exactly zero type hints for working Python code. It has by definition the same ergonomics as not having type hints.
 
@WantingtobeanAndroidDevelor only if you also end the discussion off the back of it
 
@MisterMiyagi Coz type hints are supposed to actually help you?
Why not use something that they provided specifically to help you?
I'm just complaining that it's not done well as it should be
 
10:41 PM
58 messages moved from Python
 
I mean it's a place to discuss right?
 
:55571346 No. You've evaporated 2 RO's patience now.
 
I mean, how is asking that it's a place for discussion not being nice to others?
It was a question
I am trying to be respectful here
 
10:50 PM
I mean you told me that it's not a place for a rant, and I said that's fair
 
No you're not. You know you're being disruptive
 

« first day (2834 days earlier)      last day (522 days later) »