[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread Steven D'Aprano
Are we just trying to list every imaginable word that is even vaguely 
related to the concept of "something that holds something"? If we have 
plate, tray, board then surely we should include saucer, cup, bowl, pot, 
frying_pan, cheeseboard, box, suitcase, luggage, handbag, ...

Trying to exhaustively list every synonym is just exhausting and not 
very productive. It is okay to have a first pass filter and reject words 
which are clearly unsuitable, like "plate" and "panel" (with or without 
the "attr" prefix) etc.

- A plate is a plain, featureless object, the very opposite of something 
  that has arbitrary attributes;

- a panel is best used for compound UI elements like *instrument panel*.

There isn't a generic name for "thing that we attach other things to". 
There are specific concrete examples of such: a notice board, a tool 
board, a coat rack, letter spike, meat hook, etc but they're too 
specific. The general term "board" has the wrong connotations, e.g. flat 
rather than abstract.

Other naming problems:

- it's an object, but `object` is already in use for the immutable base 
  object;

- "thing" is too generic;

- anything like "plate", "bag" etc is too specific and usually a bad 
  analogy;

- "Bunch" at least has historical usage, but it's not really a good 
  analogy for a single object with arbitrary attributes;

- anything related to "namespace" is problematic because, although the 
  object actually *is* a namespace, so is every other object; even None
  has (dunder) attributes;

- and also we're not using it as a namespace in the classical sense of
  globals or local namespace.


Fundamentally, this object with attributes doesn't have a good name, and 
the data model is suspect too. It's not really a collection, as such, 
since attributes are semantically *part of the object* as opposed to 
arbitrary data (dog.tail versus dog carrying a bone).

Nevertheless, a collection is what we're going to use it as, a key:value 
mapping where the keys are limited to identifiers and access is via 
attribute access rather than subscripting. That conflict makes it hard 
to come up with a good name for it.

Honestly, I think that while it's fun to try to imagine names for this, 
I don't think that there is a *good* name for it that everyone will 
agree on. So let's just import it using whatever name you like:

from types import SimpleNamespace as apparatus



-- 
Steve
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/6DTKMBJBHQ3VADKIMDA7LPLBMG2UU4LC/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread 2QdxY4RzWzUUiLuE
On 2021-02-20 at 13:44:21 -0500,
David Mertz  wrote:

> Cheeseshop!

But then it would never contain the attribute I ask for, and throw a
different exception every time!  ;-)
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5XPGE73JM6MA2275JW2ZVMZ6Q7VS74GL/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread David Mertz
Cheeseshop!

On Sat, Feb 20, 2021, 1:08 PM Jan Kaliszewski  wrote:

> 2021-02-18 Chris Angelico  dixit:
>
> [...]
> > Okay. Let's start bikeshedding. If SimpleNamespace were to become a
> > builtin, what should its name be? It needs to be short (obviously),
> > but not TOO short, and it needs to be at least somewhat descriptive,
> > and it needs to not cause confusion with "object". Ideally, it should
> > get a name that's unlikely to conflict with names already in frequent
> > use.
> >
> > * namespace
> > * ns
> > * Thing
> > * dump
> > * plunkit
> >
> > I'm not a fan of any of those, but let's see how inspired other
> > people are :)
>
> * plate
> * tray
> * depot
> * board
> * attrboard
> * attrholder
> * attrpanel
> * attrspace
>
> Cheers.
> *j
> ___
> Python-ideas mailing list -- python-ideas@python.org
> To unsubscribe send an email to python-ideas-le...@python.org
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-ideas@python.org/message/MIWUHKC33MN6UFYTYFDPWVA5X7R2LWMC/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/FNVIHRPFR4GSCH7FN3U434W2VOL2DEM3/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread Jan Kaliszewski
2021-02-18 Chris Angelico  dixit:

[...]
> Okay. Let's start bikeshedding. If SimpleNamespace were to become a
> builtin, what should its name be? It needs to be short (obviously),
> but not TOO short, and it needs to be at least somewhat descriptive,
> and it needs to not cause confusion with "object". Ideally, it should
> get a name that's unlikely to conflict with names already in frequent
> use.
> 
> * namespace
> * ns
> * Thing
> * dump
> * plunkit
> 
> I'm not a fan of any of those, but let's see how inspired other
> people are :)

* plate
* tray
* depot
* board
* attrboard
* attrholder
* attrpanel
* attrspace

Cheers.
*j
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MIWUHKC33MN6UFYTYFDPWVA5X7R2LWMC/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread Ricky Teachey
On Sat, Feb 20, 2021, 12:56 PM Jan Kaliszewski  wrote:

> 2021-02-17 Ricky Teachey  dixit:
>
> > * patsy
>
> I love this one! :-)
>
> Cheers.
> *j
>
> PS. But it should be callable and, when called, it should raise
> RuntimeError("It's only a model!")
>


Have to admit I was proud of this idea. Haha. Glad someone else picked up
on it.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LCQ45L653ZU7KHICJ2W6HWY5CI23YNCE/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: SimpleNamespace vs object

2021-02-20 Thread Jan Kaliszewski
2021-02-17 Ricky Teachey  dixit:

> * patsy

I love this one! :-)

Cheers.
*j

PS. But it should be callable and, when called, it should raise
RuntimeError("It's only a model!")

 
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HHN32X4LSI5LADS2K7Z7YBAEI7AWRWWZ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-ideas] Re: Syntax for duplicate types in seq[...]

2021-02-20 Thread Christopher Barker
On Fri, Feb 19, 2021 at 9:17 PM Dennis Sweeney 
wrote:

> Does this work?
>
> >>> tuple[(int,) * 7 + (str,)]
> tuple[int, int, int, int, int, int, int, str]


Even better: TImeTuple = tuple[(int,) * 7 + (str,)]

and then:

def time() ->TimeTuple
...

-CHB





-- 
Christopher Barker, PhD (Chris)

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/3PEIH3LYKDRB3E57HFYAQD2Y3GKFCJ4R/
Code of Conduct: http://python.org/psf/codeofconduct/