Comment by 8organicbits

Comment by 8organicbits 3 days ago

14 replies

It would be a lot easier if they didn't rename things. 'Text' becomes 'span' and 'justify' becomes 'text-align'. Unless there's more I'm missing, it looks like they've just added a layer of indirection.

    rio.Text(self.name, justify="left"),
Becomes:

   <span style="[...] text-align: left;">Dataset 1</span>
I'd prefer:

    rio.Span(self.name, text_align="left")
positus 3 days ago

Using the term "justify" is very common outside of web. It's been used for decades in print ("left justify / right justify / center justify"). This is indeed a web project though, so I hear what you're saying.

Sn3llius 3 days ago

We don't see ourselves as Python bindings for the web, but instead as a pythonic way to create apps. I understand that "span" has become a well known name amongst web developers, that's just not something most new developers understand.

Think of it like how Python has renamed a lot of things. What other languages call arrays, Python calls lists. HashTables are dicts, and so on. Python has faced a lot of resistance here from people that got used to the more technical names, but I think the popularity of the language speaks for itself. Easy to understand, meaningful names are a plus, not a downside :D

  • jonkoops 3 days ago

    > that's just not something most new developers understand.

    That is just false if you ask me. Eventually you reach the limits of the API defined by a framework and users will have to reach out to HTML and CSS. And now is there not only a level of indirection, but also all of the existing documentation from the Web Platform cannot be applied.

    I think there is validity for having a Python based system (instead of JS) that runs on the client to render standard HTML and CSS, but this goes beyond that and will just become an immense scope creep.

  • bee_rider 3 days ago

    Python lists aren’t arrays, right? They are the closest thing in Python to an array maybe, but they do a ton of stuff under the hood, like grow when needed.

    Calling them arrays would be very confusing to everybody who expects a typical array: a pointer with some empty space after it.

    • Sn3llius 3 days ago

      Most languages have arrays that grow automatically. I'd say C/C++ is the exception there.

      When I said array, I specifically meant O(1) access, which is in contrast to linked lists, which the name "list" would seem to imply.

      • pjmlp 3 days ago

        C++ has them on the standard library, I would make a clear split with C in this regard.

    • Phrodo_00 3 days ago

      Yeah and no? Python Lists indeed don't make any sort of array-like guarantee, but they're implemented as a vector/autogrowing-array of python object references (but these objects are not guaranteed to be cache-local).

      The implementation defines the underlying data structure as PyObject *ob_item

      • Sn3llius 3 days ago

        List access is O(1), which effectively makes them arrays :)

        • Phrodo_00 3 days ago

          Maybe if you don't consider CPU architecture, but most would expect to be able to do loops over Arrays that don't incur in a lot of cache misses, and Python Lists don't do that, since they're actually arrays of pointers to heap memory.

  • dumbo-octopus 3 days ago

    What connection do you think span has to text? To me, span is just the grouping element that defaults to display: inline. This can be used for text, but it can be used for about a million other things too. To me this looks like a fast path to a lot of docs that say “We aren’t actually putting any text in this element, but for legacy reasons it’s called Text. Version N+1 will rename it to Inline”.

  • mixmastamyk 3 days ago

    A list is not an array. Each item is a pointer to what could be any type. There’s an array module if that’s what is needed.

vanviegen 3 days ago

Their goal is for their target developers not to have to learn html and css. Text and justify make a lot more sense to those whose layouting experience is mostly based on MS Word then span and text_align do.

Also, let's not pretend that html/css is particularly well designed or easy too learn. It's the backwards compatible result of decades of experimentation, where the initial design did not even remotely consider building interactive apps with it.

Modern web app dev requires learning way to much (archaic) stuff, just to create something that ought to be simple. Rio at least seems to be trying hard to address that.

magnio 3 days ago

Yeah, that's gonna be annoying when you want to read HTML & CSS documentation and translate it to Python. How do you differentiate text-align, justify-content, justify-items, and justify-self?