On Tue, Mar 16, 2021 at 08:28:05AM -0700, Guido van Rossum wrote:
Personally, I'd like to remind you that when I designed Python my ideal was
to use punctuation in ways that are similar to the way it is used in plain
English, with exceptions only for forms commonly found in many other
programming
Thank you Roland, for that idea!
On Tue, Mar 16, 2021 at 01:52:48PM +0100, Roland Puntaier via Python-ideas
wrote:
On Mon 21Mar15 22:24, Stephen J. Turnbull wrote:
Roland Puntaier via Python-ideas writes:
Aesthetic Concern: No
=
It might seem an aesthetic concern,
but I
On Wed, Apr 14, 2021 at 09:05:17AM -0700, Christopher Barker wrote:
so that one could write:
for i in 23:
...
I am proposing this ill run the cycle ones with i=23.
iter(5)
Should return the same thing as:
iter((5,))
Yes. As I wrote in the "traverse" example below
iter(s)
should return
On Tue, Apr 13, 2021 at 05:39:42PM -, Dennis Sweeney wrote:
Whenever you extend the definition of an operation (`__iter__` in this case) to
more existing objects, you lose a little bit of the ability to catch errors
early. Consider the function:
def traverse(something):
for x in
Are there any reasons not to make scalar types iterable returning the value
ones?
Should each function check if it has got one value or a list/tuple before
iteration over the argument?
What is wrong on scalars for iteration, please?
There is even legal to iterate over an empty set – an empty cyc
Thank you, type(o) is sufficient.
It is possible to use class properties:
type(o).__name__
'c'
On Wed, Mar 03, 2021 at 10:03:03PM +, Paul Bryan wrote:
Since class is a keyword, this is unlikely. Why is type(o)
insufficient?
On Wed, 2021-03-03 at 22:59 +0100, Hans Gi
Please, consider class(obj) to return obj.__class__
consistenly with dir(), vars(), repr(), str(),…
class c: pass
o = c()
o.__class__
class(o)
File "", line 1
class(o)
^
SyntaxError: invalid syntax
Thank you in advance,
H.
___
Py
Please, is there a reason why extend() method does not return self?
a = [1,2].extend((3,4))
a
type(a)
b = [1,2]
b.extend((3,4))
b
[1, 2, 3, 4]
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le.
Please, consider class(obj) to return obj.__class__
consistenly with dir(), vars(), repr(), str(),…
class c: pass
o = c()
o.__class__
class(o)
File "", line 1
class(o)
^
SyntaxError: invalid syntax
H.
___
Python-ideas mailing list -
Is there a reason, why not to make python useful for practical one liners
to replace perl and awk?
There is page Powerful Python One-Liners,
https://wiki.python.org/moin/Powerful%20Python%20One-Liners.
But almost none of them handles files, behaves like unix filter
or is ugly – must import modules
On Thu, Oct 22, 2020 at 11:32:36PM +1100, Chris Angelico wrote:
My recommendation here would be to separate the part where you insert
a table name from the rest of the statement:
cursor.execute(f"INSERT INTO {table} "
"VALUES (1, '{}')")
That way, you aren't at risk of SQL injection in the res
On Thu, Oct 22, 2020 at 08:31:34PM +1100, Steven D'Aprano wrote:
cursor.execute(f"INSERT INTO {table} VALUES (1, '{}');")
SyntaxError: f-string: empty expression not allowed
Escape the braces by doubling them:
f"INSERT INTO {table} VALUES (1, '{{}}');"
Thank you for (ugly) workaorund.
Th
Hello,
consider this snippet please
cursor.execute(f"INSERT INTO {table} VALUES (1, '{}');")
SyntaxError: f-string: empty expression not allowed
It is (absolutely) correct to insert empty json into database table field.
Empty expression in f-string should
* (silently) expand as '{}' (opening an
there are links to each releases on the “Source code” page,
https://www.python.org/downloads/source/.
Even for documentation. Each page should contain link to its source in git repo
to easily correct typos via pull requests.
E.g., where does source of the Glossary page live,
https://docs.python
Hello,
there are links to each releases on the “Source code” page,
https://www.python.org/downloads/source/.
But I am missing a ling to the (official) git repository,
e.g. https://github.com/python or which one is it.
Thank you in advance,
Hans
___
Py
On Wed, Jul 08, 2020 at 11:32:32PM +1000, Chris Angelico wrote:
>>> T = [[11, 12, 5, 2], [15, 6, 10], [10, 8, 12, 5], [12, 15, 8, 6]]
>>> print(T[1, 2])
TypeError: list indices must be integers or slices, not tuple
If you want a helper function, it's not hard to write it:
def fetch(collection,
Why not to allow tuple as a list index?
T = [[11, 12, 5, 2], [15, 6, 10], [10, 8, 12, 5], [12, 15, 8, 6]]
print(T[1][2])
10
print(T[1, 2])
Traceback (most recent call last):
File "", line 1, in
TypeError: list indices must be integers or slices, not tuple
https://stackoverflow.com/questio
Thank you.
On Fri, Jun 26, 2020 at 02:50:22PM -0300, Joao S. O. Bueno wrote:
On Fri, 26 Jun 2020 at 14:30, Hans Ginzel wrote:
thank you for making dict ordered.
Is it planned to access key,value pair(s) by index? See
https://stackoverflow.com/a/44687752/2556118 for example. Both for
reading
Tahnk you,
On Fri, Jun 26, 2020 at 10:45:07AM -0700, Brett Cannon wrote:
Why can't you do `tuple(dict.items())` to get your indexable pairs?
of course, I can.
But how it is expensive/effective?
What are the reasons, why object dict.items() is not subscriptable –
dict.items()[0]?
Otherwise
Date: Fri, 26 Jun 2020 18:47:44 +0200
From: Hans Ginzel
To: Hans Ginzel
Subject: Access (ordered) dict by index; insert slice
Hello,
thank you for making dict ordered.
Is it planned to access key,value pair(s) by index? See
https://stackoverflow.com/a/44687752/2556118 for example. Both for
20 matches
Mail list logo