Closed clstaudt closed 1 year ago
@vlad-ed-git Which style do you prefer?
In any case, pick one and keep it consistent throughout the project.
Don't do this, it's silly:
import flet as ft
I know the flet developers do it but I think it's a silly trend, saving two letters and risking even more package name collisions than we already have in the Python world.
I prefer importing all components at the top . I only started refactoring because you prefer fewer import lines. L And I think ft for this is far better than using flet ... ft.Column , ft.Card ... is far better to my eyes than flet.Column, flet.Card . But these are all just preferences , there's isn't a science to it. We just pick one and use that.
On Wednesday, January 11, 2023, Christian Staudt @.***> wrote:
Which style do you prefer?
In any case, pick one and keep it consistent throughout the project.
Don't do this, it's silly:
import flet as ft
I know the flet developers do it but I think it's a silly trend, saving two letters and risking even more package name collisions than we already have in the Python world.
— Reply to this email directly, view it on GitHub https://github.com/tuttle-dev/tuttle/issues/131#issuecomment-1378820243, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGBW63OBLOX6SEAOEODMX3WR26GVANCNFSM6AAAAAATYC23RI . You are receiving this because you were assigned.Message ID: @.***>
Let's go for style B then.
It's not just about the amount of lines, it's about understandable code.
My thinking: When I am writing a UI view, then the components from flet are "first class citizens", I import them directly. It's clear where these things come from when I write a flet app. Other things that I need I tend to import indirectly because it's not immediately clear where they are from.
Style B is import Flet and use flet.control?
On Wednesday, January 11, 2023, Christian Staudt @.***> wrote:
Let's go for style B then.
It's not just about the amount of lines, it's about understandable code.
My thinking: When I am writing a UI view, then the components from flet are "first class citizens", I import them directly. It's clear where these things come from when I write a flet app. Other things that I need I tend to import indirectly because it's not immediately clear where they are from.
— Reply to this email directly, view it on GitHub https://github.com/tuttle-dev/tuttle/issues/131#issuecomment-1378885826, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGBW67O5VSSCJ6A6NXSS53WR3DA3ANCNFSM6AAAAAATYC23RI . You are receiving this because you were mentioned.Message ID: @.***>
from flet import (
Text,
UserControl,
ElevatedButton,
)
a_button = ElevatedButton()
Okay
On Wednesday, January 11, 2023, Christian Staudt @.***> wrote:
from flet import ( Text, UserControl, ElevatedButton, ) a_button = ElevatedButton()
— Reply to this email directly, view it on GitHub https://github.com/tuttle-dev/tuttle/issues/131#issuecomment-1378891104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJGBW67WX7TLKYZ3575QPFTWR3DMJANCNFSM6AAAAAATYC23RI . You are receiving this because you were mentioned.Message ID: @.***>
TODOs
A)
B)