Re: code to refer to a dictionary with and without nested dictionaries

2020-12-18 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

makes sense.

URL: https://forum.audiogames.net/post/599833/#p599833




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-18 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

Yes, but your approach is hammer on the keyboard until it works and just generally flail around, as far as I can tell.  Then you get to the end and it's unmaintainable and you have to rebuild it.  Then you get frustrated because that happened, and by your own admission you start being afraid to ask questions and find things out for fear that it's going to turn into "and now I have to rebuild it, that's demoralizing".  Rebuilding it is very demoralizing.  You're not wrong to feel that way.  But I don't understand why you keep doing it, when basically any other way of learning to code will get you where you want to be faster.Building a house without a foundation just means the house falls down, if you want an analogy.  It might work for a while, sure, then the first storm or whatever comes along and down it goes.My point is this.  You've reached the milestone where you're either satisfied with your current skill level, or you're ready to specifically and intentionally work on figuring out how to take this to the next level.  If you're not satisfied with your current skill level, and you're not going to intentionally work on improving because that's not fun, the only other option is to keep on as you are until you either make this choice or give up in frustration.To put this in perspective, Synthizer contains more math than 99% of this forum even knows exists, has to solve unique concurrency and threading challenges for which there aren't really libraries, has hard realtime requirements, and must be written in one of the most challenging programming languages on the planet.  It's only about 6000 lines at last count.  If I could have done it in Python I could have done it in 1 or 2.  Yes, experience matters a lot here.  But what also matters is learning for the sake of learning, and intentionally deciding that you're going to just go figure out stuff rather than try to always be doing a project with it.I want to be clear.  I want you and all the other newbie blind programmers around here to succeed.  And I can't say what's actually best for you, when it comes to learning resources.  But what you're doing seems not to be working.  I think you can probably learn it, but you'll have to start trying other things.  You've been programming for 3 years, but people who approach this as learning and not as having projects usually can understand what classes are in 3 months or less.

URL: https://forum.audiogames.net/post/599825/#p599825




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-17 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

I like programming, and the skills I learn from it, but I like socializing more. But that's not an option. So I take to coding because it engages me in a way that challenges myself. But again, it is not beyond the hobby level. I honestly didn't think about the audio game engine needing to have the modules intercept with networking. I admit, I am a dumbass for not remembering that. But I guess that is showing that I know I have to take it one step at a time with this. I have to build it without networking first. That's already a big enough task. Even if I have to copy and rewrite my audio game engine, at least I have a perfect working prototype of what I am aiming for. And it works. Sure it doesn't have the badass thrill of networking, but it's a game, that works.I'm willing to sacrifice time for a working prototype, even if the interworkings will not look anything similar. I know, i'm a fool. Coding a project based on networking without networking. Hey, I have to start somewhere. At least I'm not continuing to build it in bgt. I have given up the instant gratification of the networking, in order to focus all my attention on the ways I code it, and the cleanest way. I've learned a lot since switching to python. I've cleaned up my python code a few times, and it makes a huge difference. I don't regret making the switch from bgt to python at the sacrifice of easy networking. I do want to clarify. I am not cocky. If anything, I undermine myself all the time. But I'm trying to be positive about it. If I'm not positive, then I won't try at all. Even if I don't think I can do it, at least I will have tried.

URL: https://forum.audiogames.net/post/599699/#p599699




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-17 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

I like programming, and the skills I learn from it, but I like socializing more. But that's not an option. So I take to coding because it engages me in a way that challenges myself. But again, it is not beyond the hobby level. I honestly didn't think about the audio game engine needing to have the modules intercept with networking. I admit, I am a dumbass for not remembering that. But I guess that is showing that I know I have to take it one step at a time with this. I have to build it without networking first. That's already a big enough task. Even if I have to copy and rewrite my audio game engine, at least I have a perfect working prototype of what I am aiming for. And it works. Sure it doesn't have the badass thrill of networking, but it's a game, that works.I'm willing to sacrifice time for a working prototype, even if the interworkings will not look anything similar. I know, i'm a fool. Coding a project based on networking without networking. Hey, I have to start somewhere. At least I'm not continuing to build it in bgt. I have given up the instant gratification of the networking, in order to focus all my attention on the ways I code it, and the cleanest way. I've learned a lot since switching to python. I've cleaned up my python code a few times, and it makes a huge difference. I don't regret making the switch from bgt to python at the sacrifice of easy networking.

URL: https://forum.audiogames.net/post/599699/#p599699




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-17 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

You will find that you can intentionally cultivate disciplined thought.  Do things like write design documents for example.  List off the modules you think the thing should have.  If you want to write some sort of audiogame engine with networking to build whatever on top of it, you will need to stop treating this like a hobby.  I don't mean in the sense of time, though more time definitely helps, but in the sense of how you learn it.  There are a few core skills that are necessary to program effectively, and disciplined, logical thought is the most critical of them.You'll shortly be at a place where you either need to commit to programming and move to the next level of learning, or give up.  What I mean by this is that instead of doing projects, you start learning to program just because it's programming.  You have to actively seek out stuff like "how do classes work" and similar, just because it's interesting.  Just knowing what all the tools in the Python toolbox are and when people usually use them is a good first step, but there's a lot of stuff out there you can borrow in terms of design patterns and similar.If you don't have the level of interest to learn without specifically trying to do some big project or the discipline to learn even though you're not interested because the reward is worth it, programming may not be for you.  You can keep throwing code at the wall and have really long turnaround times and maybe you'll slowly learn things over the course of years, but that's by far the least efficient and most frustrating way to do this in the end.

URL: https://forum.audiogames.net/post/599629/#p599629




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-17 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

My brain doesn't work like that at the moment. It is hard to wrap my head around concepts like class vs dict, and it's my fault for not reading enough on it lol. Most of my projects are top to bottom, again that's how my brain works. But there actually is one project that I have found, I am doing differently from the rest...Exactly 2 years ago, I started on one of my firt successful bgt projects. It happened to have networking, because of course, it is bgt. Well that first version was so bad, that I literally wrote out 4 players with no classes. I have 4 variables for everything, and I copied the send and receive functions for every player. Yeah, talk about a pain in the ass. Back then I wanted instant gratification with that project. But since then, I have rewritten it 3 more times. After the second time, I switched to python. I stopped developing that project, but not because I gave up on it. I stopped developing it, because I want to figure all the pieces out and combine them into a sort of audio game engine first, so that  y project finally has a solid foundation with most of the design already down, from those small pieces.As far as the audio game engine, I'm aware of how big this is. It's a crazy idea. But there are modules that I always see myself using, and instead of having to copy them from project to project, I would like to have an engine that all my projects can refer to. This also helps with having multiple different versions from each project. Now sometimes, I end up modifying a module to meet the project's specific needs. But that's something I going to have to deal with after I get the initial prototype working. And the answer will most likely involve classes. Since in my instance of the class, I can add something that allows me to have specific data tfor that project.Are my plans perfect? Absolutely not. Am I crazy for trying to attempt something this big? Yes. But I've realized how much it would help me, and how much cleaner my projects would be with it. Not to mention if I need to fix a bug, or I update one of the modules, currently I have to go to every place that module is, and update it.Back to the project with networking, I know I am going to have to write it without networking first, because networking is a pain in the ass. And i have to accept that it might never get networking support. But on the off chance that it ever does, I am going to have to rewrite it a 6th time for that networking support. I've already written it 4, so there is no point in giviing up now. And if the 5th version was a success, I honestly probably would be excited enough to have the motivation to write it the 6th time to add network support. Because that's the main idea of the game.

URL: https://forum.audiogames.net/post/599589/#p599589




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-17 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

My brain doesn't work like that at the moment. It is hard to wrap my head around concepts like class vs dict, and it's my fault for not reading enough on it lol. Most of my projects are top to bottom, again that's how my brain works. But there actually is one project that I have found, I am doing differently from the rest...Exactly 2 years ago, I started on one of my firt successful bgt projects. It happened to have networking, because of course, it is bgt. Well that first version was so bad, that I literally wrote out 4 players with no classes. I have 4 variables for everything, and I copied the send and receive functions for every player. Yeah, talk about a pain in the ass. Back then I wanted instant gratification with that project. But since then, I have rewritten it 3 more times. After the second time, I switched to python. I stopped developing that project, but not because I gave up on it. I stopped developing it, because I want to figure all the pieces out and combine them into a sort of audio game engine first, so that  y project finally has a solid foundation with most of the design already down, from those small pieces.As far as the audio game engine, I'm aware of how big this is. It's a crazy idea. But there are modules that I always see myself using, and instead of having to copy them from project to project, I would like to have an engine that all my projects can refer to. This also helps with having multiple different versions from each project. Now sometimes, I end up modifying a module to meet the project's specific needs. But that's something I going to have to deal with after I get the initial prototype working. And the answer will most likely involve classes. Since in my instance of the class, I can add something that allows me to have specific data tfor that project.Are my plans perfect? Absolutely not. Am I crazy for trying to attempt something this big? Yes. But I've realized how much it would help me, and how much cleaner my projects would be with it. Not to mention if I need to fix a bug, or I update one of the modules, currently I have to go to every place that module is, and update it.

URL: https://forum.audiogames.net/post/599589/#p599589




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-17 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

You're not doing anything particularly wrong.  You don't need to be sorry, it's not like I wasn't there at some point.  But some point was over 10 years ago now for me, so I'm able to speak from a *lot* of experience.  Programming starts as a hobby for many of us, anyway.The difference between dicts and classes is that dicts hold data, and classes encapsulate behaviors.  For instance, a dict is for holding a mapping of usernames to account information.  And an account might use a dict inside itself for something else.  But the account class would offer things like validate the password, and would try to hide internal details like the fact that accounts happen to be represented by dicts.  You'd mostly not use a dict anyway because you can just put instance variables on the class (e.g. self.password="mypassword").  But the key insight is that you can change this, as long as the functions on the class don't change, and the rest of your code only uses the functions that the class exposes rather than reaching in and touching all the account state.You don't need to write general functions for functions to be useful.  Functions that are highly specific that only ever get called once in the entire program are also useful.  They're a way to make it clear to the reader that this is a step in some process, and they give the step  a name.  If you're putting a cake in the oven, for instance, you're only going to do it once, but it's easier to tell that it's cake-in-the-oven time if you call cake_into_oven, rather than setting all the dials.  The other use of such functions is that you can test them by hand by, in this lame example, trying to put other things into the oven from the Python repl, and seeing how it breaks.  Functions are a sort of barrier, where bugs will tend to happen inside the function or outside the function, but not in weird ways where something goes wrong inside the function, then something else goes wrong 5 files away.  Notice that I said tend; if you're using lots of globals and things, that's less true.Looking at this thread and your other one, you're engaging in something often referred to as top-down design: you're defining the problem, figuring out a solution in broad strokes, and then filling it in.  This is fine, and the intermediate programmer way to do such things.  But as a new programmer, you may wish to consider bottom-up design, in which you define lots of useful small pieces that solve small problems, then put them together to solve the big one after you have them working.  Eventually the distinction between these actually goes away and you kinda do both, but for the time being working from the small pieces up is probably going to do more to help you get it right than anything.

URL: https://forum.audiogames.net/post/599515/#p599515




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

Ok. Honestly I don't think I can learn the right way. I can tell you for a fact I only do this as a slight hobby. Yes I put in time into it, and some research. But definitely not enough to take this seriously. And, I get lost in advice. But that part is on me, becuase like you said I am not being clear with what I am doing. I will admit it is because I am scared to be told to stop working on it, do more learning, then rebuild it. And that makes a lot of sense. It is what I should do. I just... don't work like that though. You can call me one of those people who wants instant gratification I guess. I do try somewhat, but I could be trying a lot harder.But I want you to know that I do trust you with what you say. I'm not in denial or arrogant. If you say that there is a better way, or that I am struggling because lack of knowledge, and taking on too big of tasks, and that I don'tr recognize when to use classes verses functions verses dictionaries verses more things, I believe you. And... I surprisingly know that part. I have good expereience with functions, I have written some really cool general functions that have helped with many of my projects. But I struggle with classes, though I am slightly better off than I was a few weeks ago. And for dictionaries, yeah. Hard to tell when to use that verses a class. I guess i could do more research on that. Discussions like this help me remind myself what things i should read about sometimes.This got really long. Lol sorry. I know I'm not doing myself the best favors. My coding practices are not that great. But, I am improving. Slowly, but surely. And again, sorry I am not clear enough. And as a result, sorry for not being able to wrap my head around a lot of your advice. Ok this is really getting long. I'm stopping here. But thanks again. Your replies do help me even if it doesn't seem like it very much 

URL: https://forum.audiogames.net/post/599439/#p599439




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

I don't need to deal with it, because I understand how to model my data.  If you've got a case where you've got a thing at multiple levels of the dictionary and you don't know what level it is at, you don't have a consistent model of your data, you have a giant collection of things where each individual piece probably seemed like a good idea at the time, but the whole isn't going to work.  One way I can tell that this is the case is that you have discovered dictionaries, and are now using them for everything, rather than encapsulating pieces of this behind classes, functions, and/or modules.  Aother way that I can tell is that you still ask loosely defined questions that don't define the problem well.I could probably tell you how to construct a data model, but I don't know enough about your app to do it.  So unfortunately I can only speak in generalities.  That said, one good exercise for figuring out how to do this is to document what's going on in English as precisely as possible.  The places that end up being hard to write down or hard to explain are the places where you should rethink your design, as are the places where you just kind of go "I don't know, skip this for now".What's happened here is that you're new, you tried for something slightly above what you can handle, and backed yourself into a corner.  That's fine, I'm not judging, it's a critical part of the learning process.  If you don't push yourself like that you don't learn.  But now you're trying to get out of the corner by beating through the wall with a sledgehammer, if that makes sense.  If you do solve this dictionary access thing somehow, you'll just have another problem behind it until you fix the things that got you here.You need to break this down into smaller pieces that work independently of each other, then combine them.  For example if you have a server, write a server class that does all the server things.  If you have different kinds of servers, write a class that manages holding onto servers for you, let's you ask it what kind of server they are, and lets you iterate over them.  And so on.  Part of the problem is almost certainly that you've got some big functions that try to do 5 or 10 things, rather than a lot of small functions that all just do one thing.  I say this because if you had small functions and classes and such, you'd not be trying to reach through a nested dictionary from the top like this.You may be skeptical that I don't need what you're wanting here, but I present as proof the fact that I know something like 10 programming languages, 5 of which I can write code in fluently, and none of them have the feature you're asking for where you can store a path through a bunch of dictionaries in a variable somehow.You may be able to go very far if you give all your entities ids (see the uuid module) and then just store a dict of servers and a dict of users and a dict of etc, where the key is the id and the value is the entity itself.  If the entities are classes then you can just grab them by id and do like entities[id].do_a_cool_thing().  This sort of approach can get you pretty far before you have to think about it, if you don't mind iterating over the dictionaries with loops to find things sometimes.But unfortunately for you, I suspect that really getting into this basically boils down to doing the project.  If you want more and/or higher quality help, you need to distill what you're trying to do down to concise explanations that tell us everything we need to know.  Because of the place you're at, just doing that will probably answer half of this, as it's roughly equivalent to my "explain what's going on in English, this'll help you figure out your data model" from above.  Before it's possible for any of us to speak in anything but extremely general terms like this, you'll need to say things like "I'm building an x.  To make x work, I have servers, users, and these other things.  I need x to do y and z.  My problem is that I can't...".

URL: https://forum.audiogames.net/post/599425/#p599425




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

you've never dealt with an unknown dictionary key and a multi-layer dictionary before? Sometimes the unknown value I need is in the top layer, sometimes it isn't. I've needed to do this twice now, in just a few months. How have you not needed to do this in 10 years? I know I'm stupid, but I can't be that dumb, right? Lol. But really. How have you solved issues like this?

URL: https://forum.audiogames.net/post/599411/#p599411




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

You don't, end of story.  Any solution to this is going to be hacky, and more work than just refactoring your code.I think there's the question you're asking here, to which the answer is "you can't", and the more general question of what you're trying to do that needs this that you should be asking, because I've never needed or wanted this.What you're misunderstanding about dictionaries is that the way this works is that:dictionary[key1][key2]Is exactly equivalent to:tmp=dictionary[key1]
tmp[key2]Literally, there's a rewrite internally to oversimplify how Python's VM works, that actually pulls it out like that.  So when you're trying to index multiple levels with one pair of brackets, you can't, because the pair of brackets can only "see" one dictionary at a time.

URL: https://forum.audiogames.net/post/599393/#p599393




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

no, I am trying to be able to access both normal and a nested scope at the same time.my_server["admins"]
my_server["members"]["welcome message"]I would like to be able to refer to both "admins" and "member"["welcome message"] as a variable.value= "admins"
my_server[value]
value= "member"[welcome message]
my_server[value]However that value of a nested dictionary is an error. So how do I get around this?

URL: https://forum.audiogames.net/post/599383/#p599383




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: code to refer to a dictionary with and without nested dictionaries

With the caveat that I'm not clear on what you're trying to do, you almost never want to do what you're trying to do.  Taking your naturally nested data and flattening it for convenience is called denormalization, and 99% of the time you end up looking back and going "you know, this was a terrible mistake" even though it seemed convenient in the moment.  The right answer to a question like this is to write a class which exposes helper methods for convenient access, then hand that ownership of the dictionary.Now, if you're just asking "how do I access nested dictionaries", you just:dictionary['a']['b']And you're done.And if the question is "how do I let a user access this dictionary from the command line with convenient dot notation", the answer is that you:class InvalidKeyException(Exception):
pas

def read_impl(d, keys):
if len(keys) == 0:
return d
k = keys[0]
rest = keys[1:]
if k not in d:
raise InvalidKeyException()
new_d = d[k]
return read_limpl(new_d, rest)

def read(d, keys_str):
keys = keys_str.split(".")
return read_impl(d, keys)Or something along those lines, I didn't test it.

URL: https://forum.audiogames.net/post/599376/#p599376




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


code to refer to a dictionary with and without nested dictionaries

Hello. Is there a way to refer to a key that contains a nested dictionary? Say we have a dictionary of discord servers. In one of our servers, we have some values, like admins, welcome messages, so on. But then there are user dictionaries. This would include things like online and offline messages, sound avatars for joining and leaving voice channels, and so on. Btw I don't even know if online and offline messages are possible, but it's an example.I would like to refer to the server on the entry level, for example,server= data[ctx.guild.name]server["admins"], server["welcome messages"], etc.However, in order to access user dictionaries, I would have to put,server[username]["join avatar"]The issue is, I can not write, username["join avatar"] into a string. I could use 2 separate strings, however that would mean that the dictionary is expected to have a nested layer, so server["admins"] would then be invalid.Better phrasing of my question, how can I write a key that supports nested dictionaries while keeping my zoom on the server's entry level? I did find 1 solution, but it is awkward, ridiculous, and much more trouble than worth. If there is a solution, I am assuming it could work with an infinite amount of nests.

URL: https://forum.audiogames.net/post/599372/#p599372




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


code to refer to a dictionary with and without nested dictionaries

2020-12-16 Thread AudioGames . net Forum — Developers room : Zarvox via Audiogames-reflector


  


code to refer to a dictionary with and without nested dictionaries

Hello. Is there a way to refer to a key that contains a nested dictionary? Say we have a dictionary of discord servers. In one of our servers, we have some values, like admins, welcome messages, so on. But then there are user dictionaries. This would include things like online and offline messages, sound avatars for joining and leaving voice channels, and so on. Btw I don't even know if online and offline messages are possible, but it's an example.I would like to refer to the server on the entry level, for example,server= data[ctx.guild.name]server["admins"], server["welcome messages"], etc.However, in order to access user dictionaries, I would have to put,server[username]["join avatar"]The issue is, I can not write, username["join avatar"] into a string. I could use 2 separate strings, however that would mean that the dictionary is expected to have a nested layer, so server["admins"] would then be invalid.Better phrasing of my question, how can I write a key that supports nested dictionaries while keeping my zoom on the server's entry level?

URL: https://forum.audiogames.net/post/599372/#p599372




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector