agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
Some comments on PL/Python documentation
3+ messages / 2 participants
[nested] [flat]

* Some comments on PL/Python documentation
@ 2024-12-29 00:48 PG Doc comments form <noreply@postgresql.org>
  2025-01-08 08:45 ` Re: Some comments on PL/Python documentation Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2024-12-29 00:48 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: gri.bogdan.2020@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/plpython-data.html
Description:

Hello,
In my opinion, some phrases on this page are not quite correct.

44.2.4. Composite Types
You say: '...Object (any object providing method __getattr__)...'
Actually, the object class provides the __getattribute__() method but not
the __getattr__() method. 
See https://docs.python.org/3/reference/datamodel.html#object.__getattr__

44.2.5. Set-Returning Functions
1. You say: '...Sequence type (tuple, list, set)...'
Being an unordered collection, sets do not record element position or order
of insertion. Accordingly, sets do not support indexing, slicing, or other
sequence-like behavior.
See
https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset

2. You say: '...Iterator (any object providing __iter__ and next
methods)...'
Actually, the iterator objects must support the __next__() method.
See https://docs.python.org/3/glossary.html#term-iterator

Regards,
Bogdan Grigorenko


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Some comments on PL/Python documentation
  2024-12-29 00:48 Some comments on PL/Python documentation PG Doc comments form <noreply@postgresql.org>
@ 2025-01-08 08:45 ` Peter Eisentraut <peter@eisentraut.org>
  2025-04-03 09:11   ` Re: Some comments on PL/Python documentation Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Peter Eisentraut @ 2025-01-08 08:45 UTC (permalink / raw)
  To: gri.bogdan.2020@gmail.com; pgsql-docs@lists.postgresql.org

On 29.12.24 01:48, PG Doc comments form wrote:
> Page: https://www.postgresql.org/docs/17/plpython-data.html
> Description:
> 
> Hello,
> In my opinion, some phrases on this page are not quite correct.
> 
> 44.2.4. Composite Types
> You say: '...Object (any object providing method __getattr__)...'
> Actually, the object class provides the __getattribute__() method but not
> the __getattr__() method.
> See https://docs.python.org/3/reference/datamodel.html#object.__getattr__

Yes, this looks slightly inaccurate.  I'm not sure __getattribute__ is 
fully correct either, because types can also implement other ways of 
returning attributes, especially if they are implemented in C.  Is there 
a neutral and accurate way to describe this?

> 44.2.5. Set-Returning Functions
> 1. You say: '...Sequence type (tuple, list, set)...'
> Being an unordered collection, sets do not record element position or order
> of insertion. Accordingly, sets do not support indexing, slicing, or other
> sequence-like behavior.
> See
> https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset

I think this is correct as it is.  Python sets can be iterated over, so 
this works.  Note that earlier in the page under composite types it says 
"but not a set because it is not indexable", so this distinction was 
taken into consideration.

> 2. You say: '...Iterator (any object providing __iter__ and next
> methods)...'
> Actually, the iterator objects must support the __next__() method.
> See https://docs.python.org/3/glossary.html#term-iterator

Yes, this was recently fixed already and will appear in the next patch 
release.






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Some comments on PL/Python documentation
  2024-12-29 00:48 Some comments on PL/Python documentation PG Doc comments form <noreply@postgresql.org>
  2025-01-08 08:45 ` Re: Some comments on PL/Python documentation Peter Eisentraut <peter@eisentraut.org>
@ 2025-04-03 09:11   ` Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2025-04-03 09:11 UTC (permalink / raw)
  To: gri.bogdan.2020@gmail.com; pgsql-docs@lists.postgresql.org

On 08.01.25 09:45, Peter Eisentraut wrote:
>> 44.2.5. Set-Returning Functions
>> 1. You say: '...Sequence type (tuple, list, set)...'
>> Being an unordered collection, sets do not record element position or 
>> order
>> of insertion. Accordingly, sets do not support indexing, slicing, or 
>> other
>> sequence-like behavior.
>> See
>> https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset
> 
> I think this is correct as it is.  Python sets can be iterated over, so 
> this works.  Note that earlier in the page under composite types it says 
> "but not a set because it is not indexable", so this distinction was 
> taken into consideration.

I have added a test for returning Python sets from SETOF functions.  It 
makes sense to test this if the documentation claims it.






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-04-03 09:11 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-12-29 00:48 Some comments on PL/Python documentation PG Doc comments form <noreply@postgresql.org>
2025-01-08 08:45 ` Peter Eisentraut <peter@eisentraut.org>
2025-04-03 09:11   ` Peter Eisentraut <peter@eisentraut.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox