Re: XML Considered Harmful

2021-09-24 Thread Greg Ewing
On 25/09/21 10:51 am, dn wrote: XML: Originally invented for text markup, and that shows. Can represent different types (via tags), can define those types (via DTD and/or schemas), can identify schemas in a globally-unique way and you can mix them all in a single document (and there are tools ava

Re: XML Considered Harmful

2021-09-24 Thread Greg Ewing
On 25/09/21 11:00 am, Chris Angelico wrote: On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list wrote: and YAML? Invented because there weren't enough markup languages, so we needed another? There were *too many* markup languages, so we invented another! -- Greg -- https://mail.python.org/

Re: XML Considered Harmful

2021-09-24 Thread Greg Ewing
On 25/09/21 6:34 am, Peter J. Holzer wrote: Several hundred genes were recently renamed because Excel was unable to read their names as simply strings and insisted on interpreting them as something else (e.g. dates). Another fun one I've come across is interpreting phone numbers as floating poi

Re: XML Considered Harmful

2021-09-24 Thread Greg Ewing
On 25/09/21 6:29 am, Peter J. Holzer wrote: don't forget that XML was intended to replace SGML, and that SGML was intended to mark up text, not represent any data. And for me this is the number one reason why XML is the wrong tool for almost everything it's used for nowadays. It's bizarre. It'

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Chris Angelico
On Sat, Sep 25, 2021 at 11:11 AM Oscar Benjamin wrote: > > On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: >> >> On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin >> wrote: >> > >> > On Sat, 25 Sept 2021 at 00:37, Greg Ewing >> > wrote: >> > > I suppose they could be fiddled somehow to make

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 02:01, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin > wrote: > > > > On Sat, 25 Sept 2021 at 00:37, Greg Ewing > > wrote: > > > I suppose they could be fiddled somehow to make it possible, but > > > that would be turning them into special cases

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Chris Angelico
On Sat, Sep 25, 2021 at 10:56 AM Oscar Benjamin wrote: > > On Sat, 25 Sept 2021 at 00:37, Greg Ewing > wrote: > > > On 25/09/21 10:15 am, Steve Keller wrote: > > > BTW, I like how the min() and max() functions allow both ways of being > > > called. > > > > That wouldn't work for set.union and set

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Oscar Benjamin
On Sat, 25 Sept 2021 at 00:37, Greg Ewing wrote: > On 25/09/21 10:15 am, Steve Keller wrote: > > BTW, I like how the min() and max() functions allow both ways of being > > called. > > That wouldn't work for set.union and set.intersection, because as > was pointed out, they're actually methods, so

Re: XML Considered Harmful

2021-09-24 Thread Jon Ribbens via Python-list
On 2021-09-24, Chris Angelico wrote: > On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list > wrote: >> On 25/09/2021 06.59, Peter J. Holzer wrote: >> > CSV: Good for tabular data of a single data type (strings). As soon as >> > there's a second data type (numbers, dates, ...) you leave standard >>

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Greg Ewing
On 25/09/21 10:15 am, Steve Keller wrote: BTW, I like how the min() and max() functions allow both ways of being called. That wouldn't work for set.union and set.intersection, because as was pointed out, they're actually methods, so set.union(some_seq) is a type error: >>> a = {1, 2} >>> b = {

Re: XML Considered Harmful

2021-09-24 Thread David L Neil via Python-list
On 25/09/2021 11.00, Chris Angelico wrote: > Invented because there weren't enough markup languages, so we needed another? Anything You Can Do I Can Do Better https://www.youtube.com/watch?v=_UB1YAsPD6U -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: XML Considered Harmful

2021-09-24 Thread Chris Angelico
On Sat, Sep 25, 2021 at 8:53 AM dn via Python-list wrote: > > On 25/09/2021 06.59, Peter J. Holzer wrote: > > There are a gazillion formats and depending on your needs one of them > > might be perfect. Or you may have to define you own bespoke format (I > > mean, nobody (except Matt Parker) tries

Re: XML Considered Harmful

2021-09-24 Thread dn via Python-list
On 25/09/2021 06.59, Peter J. Holzer wrote: > There are a gazillion formats and depending on your needs one of them > might be perfect. Or you may have to define you own bespoke format (I > mean, nobody (except Matt Parker) tries to represent images or videos as > CSVs: There's PNG and JPEG and WEB

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Steve Keller
"Dieter Maurer" writes: > Steve Keller wrote at 2021-9-24 11:48 +0200: > >Why do some built-in Python functions feel so differently: > > Because the typical use cases are different > > [...] > > >while other functions like set.union() and set.intersection() work on > >a list of arguments but n

Re: XML Considered Harmful

2021-09-24 Thread Peter J. Holzer
On 2021-09-21 13:12:10 -0500, Michael F. Stemper wrote: > I read this page right when I was about to write an XML parser > to get data into the code for a research project I'm working on. > It seems to me that XML is the right approach for this sort of > thing, especially since the data is hierarch

Re: XML Considered Harmful

2021-09-24 Thread Peter J. Holzer
On 2021-09-23 06:53:10 -0600, Mats Wichmann wrote: > The problem with csv is that a substantial chunk of the world seems to > live inside Excel, This is made sp much worse by Excel being exceptionally bad at reading CSV. Several hundred genes were recently renamed because Excel was unable to read

Re: XML Considered Harmful

2021-09-24 Thread Peter J. Holzer
On 2021-09-21 19:46:19 -0700, Dan Stromberg wrote: > On Tue, Sep 21, 2021 at 7:26 PM Michael F. Stemper < > michael.stem...@gmail.com> wrote: > > If XML is not the way to package data, what is the recommended > > approach? > > > > I prefer both JSON and YAML over XML. > > XML has both elements an

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Chris Angelico
On Sat, Sep 25, 2021 at 3:42 AM Stefan Ram wrote: > > "Dieter Maurer" writes: > >A list is ordered. Therefore, it is important where > >in this order an element is added. Thus, for a list, > >`append` is a better name than `add` -- because it already > >tells us in the name where it adds the new

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Dieter Maurer
Stefan Ram wrote at 2021-9-24 14:53 GMT: >Steve Keller writes: >>Why do some built-in Python functions feel so differently: > >|>>> s = set() >|>>> s.add( 1 ) >|>>> > > >|>>> l = [] >|>>> l.add( 1 ) > >| >|Traceback (most recent call last): >| File "", line 1, in >|AttributeError: 'list' object

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Dieter Maurer
Steve Keller wrote at 2021-9-24 11:48 +0200: >Why do some built-in Python functions feel so differently: Because the typical use cases are different >For example sum(), all(), any() expect exactly one argument which is a >sequence to operate on, i.e. a list, an iterator or a generator etc. > >

Re: XML Considered Harmful

2021-09-24 Thread Mostowski Collapse
Or then use cryptographic methods to protect your XML file when in transit. Like encryption and/or signatures. Mostowski Collapse schrieb am Freitag, 24. September 2021 um 15:46:27 UTC+2: > BTW: I think its problematic to associate Java with XML. > Michael F. Stemper schrieb am Dienstag, 21. Sep

Re: XML Considered Harmful

2021-09-24 Thread Mostowski Collapse
BTW: I think its problematic to associate Java with XML. Michael F. Stemper schrieb am Dienstag, 21. September 2021 um 20:12:33 UTC+2: > On the prolog thread, somebody posted a link to: > The above linke is very old, from 2004, and might

Re: Different "look and feel" of some built-in functions

2021-09-24 Thread Chris Angelico
On Fri, Sep 24, 2021 at 11:47 PM Steve Keller wrote: > > Why do some built-in Python functions feel so differently: > > For example sum(), all(), any() expect exactly one argument which is a > sequence to operate on, i.e. a list, an iterator or a generator etc. > > sum([1,2,3,4]) > sum(ran

Re: Type annotation pitfall

2021-09-24 Thread Chris Angelico
On Fri, Sep 24, 2021 at 11:43 PM Peter Saalbrink wrote: > > I don't think this has anything to do with typing or providing type hints. > The type hint is the `: set` part, not the `= set()` part. > You can declare the type without assigning to the variable. > Indeed, as you already said, `x` is a

Re: Flush / update GUIs in PyQt5 during debugging in PyCharm

2021-09-24 Thread DFS
On 9/24/2021 12:46 AM, Mohsen Owzar wrote: Hi Guys I've written a GUI using PyQt5 and in there I use StyleSheets (css) for the buttons and labels to change their background- and foreground-colors and their states as well. Because my program doesn't function correctly, I try to debug it in my ID

Different "look and feel" of some built-in functions

2021-09-24 Thread Steve Keller
Why do some built-in Python functions feel so differently: For example sum(), all(), any() expect exactly one argument which is a sequence to operate on, i.e. a list, an iterator or a generator etc. sum([1,2,3,4]) sum(range(1, 101)) sum(2**i for i in range(10)) all([True, False])

Re: Type annotation pitfall

2021-09-24 Thread Greg Ewing
On 24/09/21 5:48 pm, Robert Latest wrote: Never use mutable types in type hint, No, the lesson is: Don't mutate a shared object if you don't want the changes to be shared. If you want each instance to have its own set object, you need to create one for it in the __init__ method, e.g. class Fo

Re: Type annotation pitfall

2021-09-24 Thread Peter Saalbrink
I don't think this has anything to do with typing or providing type hints. The type hint is the `: set` part, not the `= set()` part. You can declare the type without assigning to the variable. Indeed, as you already said, `x` is a class property here, and is shared amongst instances of the class.