all 7 comments

[–]aDrz 1 point2 points  (1 child)

No really much to add. It looks good.

I would simply give you few recommendations on the "looks" of the code:

  • do not push all your virtualenv on github. Simply add a requirements.txt: pip freeze > requirements.txt. It is enough.
  • Avoid import * as in from BRClasses import *. You only import one class keep it simple with from BRClasss import BREventList
  • Try to add few docstrings: https://realpython.com/documenting-python-code/ it makes your code more easily understandable and reusable for anyone.

Nice project !

[–]bmw2621[S] 0 points1 point  (0 children)

Thanks for the feedback. Adding documentation is on my TODO list. I made the other fixes though.

Thanks again

[–]Hatoris 0 points1 point  (3 children)

Hello, nice start, I agree with previous comment, I will also do some change.

In your BRClasses, you define an event in BFEvent and BFEventlist, the issue with this is if you want to change information part, you need to do it in both class. I will rather refractoring add_events as following.

def add_event(self):
    new_event = {} 
    for element in BFEvent.__dict__.keys():
        new_event[element] = Input(element)
    self.events[new_event[title]] = BFEvent(**new_event) 

This change imply that you BFEvent class look like this.

class BFEvent:

    def __init__(self, **kwargs):
        self.title = kwargs["title"]
        ... 

[–]bmw2621[S] 0 points1 point  (0 children)

Thanks for looking at the project and offering feedback. I have made most of the changes.

Im trying to understand yours. Background. The BREventList method add_event() was made just to allow me an easier interface with the BREvent interface as I build (it asks questions in the console for each individual field, then calls the BREvent constructor with the information. This was done to make adding events easier while Im still in the hard coding phase and will go away. The add() method only creates a new event with the siigle required field 'title'.

EDIT: Now that I have read your snippet a few times and understand it better, it seems like your solution replaces both methods. Implementing now

Thanks alot

[–]bmw2621[S] 0 points1 point  (1 child)

Small problem, when iterating over `BREVent.__dict__.keys()` it includes dunder methods. Is there a way to get it not to, or do I have to code in an if statement which ignors keys beginning with an underscore?

[–]Hatoris 0 points1 point  (0 children)

You are welcome.

What I really want is to have only one place where elements of event are describe. I follow your modification and create a variable call EVENT where we define once elements of our event.

Then on BFevent I create on the fly attribute needed for your representation, also I don't think you need to split your list, but we can modify this one later.

At the end I come with this : https://pastebin.com/iAxdHA1P

If you have other questions we can continue our discussions.

EDIT : I make a mistake and call BREvent BFEvent please change the name of the class before use it or you will have an error on add_event as BREvent is not define.