On 12/03/2018 18:05, Chris Angelico wrote:
On Tue, Mar 13, 2018 at 2:54 AM, Robin Becker wrote:
On 12/03/2018 13:17, Robin Becker wrote:
An alternative approach gives more orderly sequences using a variable base
number construction
4 (0, 0, 1)
9 (0, 0, 1)
18 (0, 0, 2)
32 (0, 0, 2)
I spy dup
On Sat, 10 Mar 2018 11:15:49 +, Paul Moore wrote:
> On 10 March 2018 at 02:18, MRAB wrote:
[...]
>> This might help, although the order they come out might not be what you
>> want:
>>
>> def triples():
>> for total in itertools.count(1):
>> for i in range(1, total):
>>
On Sun, 11 Mar 2018 01:40:01 +, Ben Bacarisse wrote:
> I'm sure deep recursion is not needed, it's just tricky translating from
> a lazy language when one is not familiar with all the iterator
> facilities in Python. For example, I couldn't find an append operation
> that returns an iterable.
On Mon, 12 Mar 2018 13:17:15 +, Robin Becker wrote:
> It's possible to generalize the cantor pairing function to triples, but
> that may not give you what you want. Effectively you can generate an
> arbitrary number of triples using an iterative method. My sample code
> looked like this
>
>
On 13 March 2018 at 11:01, Steven D'Aprano
wrote:
> On Sat, 10 Mar 2018 11:15:49 +, Paul Moore wrote:
>
>> On 10 March 2018 at 02:18, MRAB wrote:
> [...]
>>> This might help, although the order they come out might not be what you
>>> want:
>>>
>>> def triples():
>>> for total in itertools
How do Fractions convert to ints when they have no __int__ method?
py> from fractions import Fraction
py> x = Fraction(99, 2)
py> int(x) # works fine
49
py> x.__int__
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'Fraction' object has no attribute '__int__'
--
Ste
Am 13.03.2018 um 12:16 schrieb Steven D'Aprano:
How do Fractions convert to ints when they have no __int__ method?
It uses __trunc__:
| In general, the int() conversion should try __int__() first and if
| it is not found, try
__trunc__().[https://www.python.org/dev/peps/pep-3141/]
--
Robin
On Tue, 13 Mar 2018 12:40:26 +0100, Robin Koch wrote:
> Am 13.03.2018 um 12:16 schrieb Steven D'Aprano:
>
>> How do Fractions convert to ints when they have no __int__ method?
>
> It uses __trunc__:
Ah, thanks!
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On 10-03-18 02:13, Steven D'Aprano wrote:
> I am trying to enumerate all the three-tuples (x, y, z) where each of x,
> y, z can range from 1 to ∞ (infinity).
>
> This is clearly unhelpful:
>
> for x in itertools.count(1):
> for y in itertools.count(1):
> for z in itertools.count(1):
>
On 13/03/2018 11:14, Steven D'Aprano wrote:
On Mon, 12 Mar 2018 13:17:15 +, Robin Becker wrote:
It's possible to generalize the cantor pairing function to triples, but
that may not give you what you want. Effectively you can generate an
arbitrary number of triples using an iterative method.
On March 10, on thread "Python 2.7 -- bugfix or security before EOL?",
Guido van Russum wrote
"The way I see the situation for 2.7 is that EOL is January 1st, 2020,
and there will be no updates, not even source-only security patches,
after that date. Support (from the core devs, the PSF, and p
On 2018-03-13 10:58, Terry Reedy wrote:
> Two days later, Benjamin Peterson, the 2.7 release manager, replied
> "Sounds good to me. I've updated the PEP to say 2.7 is completely
> dead on Jan 1 2020." adding "The final release may not literally be
> on January 1st".
Am I the only one saddened by
On Wed, Mar 14, 2018 at 5:30 AM, Tim Chase
wrote:
> On 2018-03-13 10:58, Terry Reedy wrote:
>> Two days later, Benjamin Peterson, the 2.7 release manager, replied
>> "Sounds good to me. I've updated the PEP to say 2.7 is completely
>> dead on Jan 1 2020." adding "The final release may not literall
On Tue, 13 Mar 2018 10:58:42 -0400, Terry Reedy wrote:
> On March 10, on thread "Python 2.7 -- bugfix or security before EOL?",
> Guido van Russum wrote
>
> "The way I see the situation for 2.7 is that EOL is January 1st, 2020,
> and there will be no updates, not even source-only security patches
#!/usr/bin/python
import serial
import MySQLdb
while True:
#establish connection to MySQL. You'll have to change this for your database.
dbConn = MySQLdb.connect("localhost","root","1234","ifet") or die
("could not connect to database")
#open a cursor to the database
cu
On Wed, Mar 14, 2018 at 11:23 AM, Dhileepan Kumar wrote:
>
> #!/usr/bin/python
>
> import serial
> import MySQLdb
> while True:
> #establish connection to MySQL. You'll have to change this for your database.
> dbConn = MySQLdb.connect("localhost","root","1234","ifet") or die
> ("could not
On 2018-03-14 00:23, Dhileepan Kumar wrote:
#!/usr/bin/python
import serial
import MySQLdb
while True:
#establish connection to MySQL. You'll have to change this for your database.
dbConn = MySQLdb.connect("localhost","root","1234","ifet") or die ("could
not connect to database")
Lawrence D’Oliveiro writes:
> On Tuesday, March 13, 2018 at 1:58:48 PM UTC+13, Ben Bacarisse wrote:
>> Of course you can always generate n-tuples of N and then map these to
>> n-tuples of the intended sequence but that seems inelegant.
>
> This whole discussion seems to be going off on esoteric,
Explain the difference between these two triple-quoted strings:
Here is a triple-quoted string containing spaces and a triple-quote:
py> """ \""" """
' """ '
But remove the spaces, and two of the quotation marks disappear:
py> """\""
'"'
If nobody gets the answer, I shall reveal all late
On Wed, 14 Mar 2018 04:08:30 +, Steven D'Aprano wrote:
> Explain the difference between these two triple-quoted strings:
> But remove the spaces, and two of the quotation marks disappear:
>
> py> """\""
> '"'
That's (a) a triple quoted string containing a single escaped quote,
followed
Announcing the immediate availability of Python 3.6.5 release candidate 1!
Python 3.6.5rc1 is the first release candidate for Python 3.6.5, the next
maintenance release of Python 3.6. While 3.6.5rc1 is a preview release and,
thus, not intended for production environments, we encourage you to expl
On 14Mar2018 04:08, Steven D'Aprano
wrote:
Explain the difference between these two triple-quoted strings:
Here is a triple-quoted string containing spaces and a triple-quote:
py> """ \""" """
' """ '
But remove the spaces, and two of the quotation marks disappear:
py> """\""
'"'
"""
Dan Sommers wrote:
On Wed, 14 Mar 2018 04:08:30 +, Steven D'Aprano wrote:
Explain the difference between these two triple-quoted strings:
But remove the spaces, and two of the quotation marks disappear:
py> """\""
'"'
That's (a) a triple quoted string containing a single escaped q
23 matches
Mail list logo