Igor Berger writes:
> On Saturday, January 28, 2023 at 10:02:57 PM UTC-5, Ben Bacarisse wrote:
>> Jon Ribbens writes:
>>
>> > On 2023-01-29, Ben Bacarisse wrote:
>> >> "Peter J. Holzer" writes:
>> >>
>> >
Jon Ribbens writes:
> On 2023-01-29, Ben Bacarisse wrote:
>> "Peter J. Holzer" writes:
>>
>>> On 2023-01-27 21:04:58 +, Ben Bacarisse wrote:
>>>> mutt...@dastardlyhq.com writes:
>>>>
>>>> > Hi
>>&
"Peter J. Holzer" writes:
> On 2023-01-27 21:04:58 +, Ben Bacarisse wrote:
>> mutt...@dastardlyhq.com writes:
>>
>> > Hi
>>
>> It looks like you posted this question via Usenet. comp.lang.python is
>> essentially dead as a Usenet group
mutt...@dastardlyhq.com writes:
> Hi
It looks like you posted this question via Usenet. comp.lang.python is
essentially dead as a Usenet group. It exists, and gets NNTP versions
of mail sent to the mailing list, but nothing posted to the group via
NNTP get send on the mailing list. I prefer Us
Chris Angelico writes:
> On Thu, 26 Jan 2023 at 08:19, Dino wrote:
>>
>> On 1/23/2023 11:22 PM, Dino wrote:
>> > >>> b = True
>> > >>> isinstance(b,bool)
>> > True
>> > >>> isinstance(b,int)
>> > True
>> > >>>
>>
>> ok, I read everything you guys wrote. Everyone's got their reasons
>> obviou
James Tsai writes:
> I find it very useful if I am allowed to define new local variables in
> a list comprehension. For example, I wish to have something like
> [(x, y) for x in range(10) for y := x ** 2 if x + y < 80], or
> [(x, y) for x in range(10) with y := x ** 2 if x + y < 80].
>
> For now
Grant Edwards writes:
> On 2021-11-20, Ben Bacarisse wrote:
>
>> You seem to be agreeing with me. It's the floating point part that is
>> the issue, not the base itself.
>
> No, it's the base. Floating point can't represent 3/10 _because_ it's
> b
Chris Angelico writes:
> On Sat, Nov 20, 2021 at 3:41 PM Ben Bacarisse wrote:
>>
>> Chris Angelico writes:
>>
>> > On Sat, Nov 20, 2021 at 12:43 PM Ben Bacarisse
>> > wrote:
>> >>
>> >> Chris Angelico writes:
>> >
Chris Angelico writes:
> On Sat, Nov 20, 2021 at 12:43 PM Ben Bacarisse wrote:
>>
>> Chris Angelico writes:
>>
>> > On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse wrote:
>> >>
>> >> Chris Angelico writes:
>> >>
>> >&g
Chris Angelico writes:
> On Sat, Nov 20, 2021 at 9:07 AM Ben Bacarisse wrote:
>>
>> Chris Angelico writes:
>>
>> > On Sat, Nov 20, 2021 at 5:08 AM ast wrote:
>>
>> >> >>> 0.3 + 0.3 + 0.3 == 0.9
>> >> False
>> >
>
Chris Angelico writes:
> On Sat, Nov 20, 2021 at 5:08 AM ast wrote:
>> >>> 0.3 + 0.3 + 0.3 == 0.9
>> False
>
> That's because 0.3 is not 3/10. It's not because floats are
> "unreliable" or "inaccurate". It's because the ones you're entering
> are not what you think they are.
>
> When will peop
Arak Rachael writes:
> On Wednesday, 7 July 2021 at 12:47:40 UTC+2, Arak Rachael wrote:
>> On Wednesday, 7 July 2021 at 12:41:44 UTC+2, Ben Bacarisse wrote:
>> > Arak Rachael writes:
>> >
>> > > this time I am stuck on gaussian_filter scipy returns none
Arak Rachael writes:
> this time I am stuck on gaussian_filter scipy returns none instead of some
> valid gaussian filtered image, can someone help me please.
>
> Here is the full code:
> https://www.dropbox.com/s/18ylpiwmhlu5n62/test_filter_xdog.ipynb?dl=0
It might help to link to the code its
Mr Flibble writes:
>> Someone who says that he is capable of writing a compiler that
>> translates every language has megalomania. No one can do this.
>
> Just because you can't make one it doesn't follow that nobody else
> can.
True, but lots of very knowledgeable people have tried and failed.
"Avi Gross" writes:
> Thanks for sharing. I took a look and he does have a few schemas for Ada and
> C from TWO YEARS ago. Nothing about the infinite number of other languages
> he plans on supporting, let alone Python. And what he has is likely not
> enough to do what he claims he can do easily
Ethan Furman writes:
> On 2/15/21 2:02 PM, Grant Edwards wrote:
>> On 2021-02-15, Ben Bacarisse wrote:
>>
>>> You said you used Usenet (and your reply here was via Usenet).
>>> Usenet posts to comp.lang.python don't go to the mailing list (the
>>>
Mr Flibble writes:
> On 15/02/2021 18:09, Ethan Furman wrote:
>> Thank you to those who pointed out this individual to the
>> moderators. As Mr. Flibble accurately noted, he is not on the mailing
>> list -- so his posts won't be here either.
>
> ORLY?
You said you used Usenet (and your reply her
panfei writes:
> 4. Test sqlite3
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
import sqlite3
conn = sqlite3.connect(':memory:')
conn.create_function('f', 2, lambda *args: None, deter
Bischoop writes:
> Let me clarify what I want to do:
> We all know Scrabble game.
> there's a file with Dictionary containing word in each line, the idea is
> to input some letters for example mentioned earlier: att, the script
> supposed to find all words in which letters: 'a','t','t' occur and
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> This C program use a local /static/ variable.
>
> main.c
>
> #include
>
> int f( void )
> { static int i = 0;
> return i++; }
>
> int main( void )
> { printf( "%d\n", f() );
> printf( "%d\n", f() );
> printf( "%d\n", f() ); }
>
> transcri
Shivlal Sharma writes:
> I have seen this code on one of competative programming site but I
> didn't get it, Why output is 9?
>
> from functools import *
>
> def ADDS(a,b):
> return a+1
> nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
> add = reduce(ADDS, nums)
> print(add)
>
> output: 9
Hint:
reduce(f
Roel Schroeven writes:
> Ben Bacarisse schreef op 27/05/2020 om 17:53:
>> There is well-known (*nix) software that relies on a/b/c/ meaning
>> something different to a/b/c but I don't know anyone who thinks this is
>> a good idea. It causes no end of confusion.
>
&
BlindAnagram writes:
> On 27/05/2020 16:53, Ben Bacarisse wrote:
>> As it should. Relying on a trailing \ having the right effect is
>> brittle to say the least.
>
> In my case less brittle than leaving it out.
Brittle does not mean broken. I know you can fix it by mak
BlindAnagram writes:
> On 27/05/2020 13:30, Ben Bacarisse wrote:
>> BlindAnagram writes:
>>
>>> The issue that I raised here was whether the behaviour of os.path.join()
>>> in treating the Windows directory separator '\\' as an absolute path
>>
BlindAnagram writes:
> The issue that I raised here was whether the behaviour of os.path.join()
> in treating the Windows directory separator '\\' as an absolute path
> should be considered a bug.
You think it should be considered to be a relative path? The only
meaning that would give you want
BlindAnagram writes:
> I came across an issue that I am wondering whether I should report as an
> issue. If I have a directory, say:
>
> base='C:\\Documents'
>
> and I use os.path.join() as follows:
>
> join(base, '..\\..\\', 'build', '')
It rather defeats the purpose of os.sep if you inclu
moi writes:
> Le samedi 7 mars 2020 16:41:10 UTC+1, R.Wieser a écrit :
>> Moi,
>>
>> > Fortunately, UTF-8 has not been created the Python devs.
>>
>> And there we go again, making vague statements/accusations - without
>> /anything/ to back it up ofcourse
>>
>> Kiddo, you have posted a couple
moi writes:
> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a ÄCcrit :
>> moi writes:
>>
>> >>>> 'Ä¿'.encode('utf-8')
>> > b'\xc3\xbf'
>> >>>> 'Ä¿'.encode('utf-16-le')
>&g
moi writes:
> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a écrit :
>> moi writes:
>>
>> >>>> 'ÿ'.encode('utf-8')
>> > b'\xc3\xbf'
>> >>>> 'ÿ'.encode('utf-16-le')
>> >
moi writes:
> Le jeudi 5 mars 2020 13:20:38 UTC+1, Ben Bacarisse a écrit :
>> moi writes:
>>
>> >>>> 'ÿ'.encode('utf-8')
>> > b'\xc3\xbf'
>> >>>> 'ÿ'.encode('utf-16-le')
>> >
moi writes:
'ÿ'.encode('utf-8')
> b'\xc3\xbf'
'ÿ'.encode('utf-16-le')
> b'\xff\x00'
'ÿ'.encode('utf-32-le')
> b'\xff\x00\x00\x00'
That all looks as expected. Is there something about the output that
puzzles you? Did you have a question?
--
Ben.
--
https://mail.python.org/mail
A S writes:
> On Thursday, 12 December 2019 02:28:09 UTC+8, Ben Bacarisse wrote:
>> A S writes:
>>
>> > I would like to extract all words within specific keywords in a .txt
>> > file. For the keywords, there is a starting keyword of "PROC SQL;" (I
A S writes:
> I would like to extract all words within specific keywords in a .txt
> file. For the keywords, there is a starting keyword of "PROC SQL;" (I
> need this to be case insensitive) and the ending keyword could be
> either "RUN;", "quit;" or "QUIT;". This is my sample .txt file.
>
> Thus
Madhavan Bomidi writes:
> I have the following IDL program lines. I want to write equivalent
> Python program lines. Can anyone suggest me equivalent Pythons program
> lines?
>
> # --- 1 --- #
> How to handle the format in IDL to Python?
>
> IDL program line:
>
Danilo Coccia writes:
> Il 18/07/2019 12:27, Ben Bacarisse ha scritto:
>> Irv Kalb writes:
>>
>>> I have always thought that split and join are opposite functions. For
>>> example, you can use a comma as a delimiter:
>>>
>>>>>> m
Irv Kalb writes:
> I have always thought that split and join are opposite functions. For
> example, you can use a comma as a delimiter:
>
myList = ['a', 'b', 'c', 'd', 'e']
myString = ','.join(myList)
print(myString)
> a,b,c,d,e
>
myList = myString.split(',')
print(myLis
Christian Gollwitzer writes:
> Am 17.05.19 um 06:13 schrieb Stefan Ram: However, look at this
>>
>> |>>> print( str( print ))
>> |
>>
>> |>>> print( repr( print ))
>> |
>>
>>. While it is nice that »str( print )« gives some useful
>>information, I would expect »repr( print )« to give
>>
binoythomas1...@gmail.com writes:
> When I run the following code, I get the following output:
print(type(5))
> class 'int'
>
> Next, I try to compare the data-type of 5 with the earlier output, I
> get no output:
if type(5) == "":
> print("Integer")
>
> Why isn't this working? A
Donald Tripdarlinq writes:
> In the traditional Yoruba tribal Set-Up in Nigeria,West Africa the
> tradition of inheritance is very important. Now, The relative position
> of a child in the family counts when the issue of inheritance is
> considered.
>
> Question: Now a farmer with 10 children die
Gilmeh Serda writes:
> On Fri, 19 Apr 2019 21:01:05 +, Stefan Ram wrote:
>
>> Has this ever been a problem for someone?
>
> Only for programmers who come here from other languages and expect Python
> to behave in the same manner as their favorite language, so they try and
> argue that thi
Sayth Renshaw writes:
>> Now, what happens when the code is tested with various (different) sets
>> of test-data?
>> (remember the last question from my previous msg!?)
>>
> It fails on any list entry that isn't a float or an int, giving a TypeError.
>
>> Once you are happy with the various tes
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> Ben Bacarisse writes:
>>Ranjith Bantu writes:
>>>can I solve any problems like this by learning python?
>>You need to learn how to solve problems as well as learning Python --
>
> I do not separate "solv
Ranjith Bantu writes:
> A numeric array of length 'N' is given. you need to design a function
> that finds all positive numbers in the array that have their opposites
> in it swell. give the approach for solving the optimal average or best
> case performance. answer will be your obsolute.
> Array
"Steve" writes:
> OK, I wrote:
>
> x = "A"
> print("x = " + x)
>
> def f(y):
> print("x= " + x + " y= "+ y)
>
> f(x)
>
> and it worked, inspite of what I was seeing in my own program.
> How quick I am to blame Python. (:
> When I isolate my function that stumped me, I will post it.
T
Grant Edwards writes:
> On 2019-02-07, Ben Bacarisse wrote:
>> Ian Clark writes:
>>
>>> This is my whack at it, I can't wait to hear about it being the wrong big o
>>> notation!
>>>
>>> numbers=[]
>>>
>>> while len
Bart writes:
> On 07/02/2019 20:45, Ben Bacarisse wrote:
>> Ian Clark writes:
>>
>>> This is my whack at it, I can't wait to hear about it being the wrong big o
>>> notation!
>>>
>>> numbers=[]
>>>
>>> while len(numbers)
Ian Clark writes:
> This is my whack at it, I can't wait to hear about it being the wrong big o
> notation!
>
> numbers=[]
>
> while len(numbers) < 10:
> try:
> chip = int(input('please enter an integer: '))
> except ValueError:
> print('that is not a number, try again')
>
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> source = \
> 'Python is an easy to learn, powerful programming language. It has' + \
> ' efficient high-level data structures and a simple but effective' + \
> ' approach to object-oriented programming. Python's elegant syntax' + \
You have an unexsc
Abdur-Rahmaan Janhangeer writes:
> let us say that i have a box of 5 balls,
>
> green balls - 2 with probability 2/5
> red balls 2 - with probability 2/5
> blue balls 1 - with probability 1/5
>
> how to program the selection so that the random choices reflect the
> probabilities?
>>> import rand
"Avi Gross" writes:
> The following is a function that iterates over the dictionary one key at a
> time and when it reaches a random one, it returns the key without further
> evaluation. On the average, it takes N/2 iterations for N keys. Asking to
> make a list(data) may be efficient in terms of
Marko Rauhamaa writes:
> Chris Angelico :
>
>> On Sat, Dec 1, 2018 at 10:16 PM Marko Rauhamaa wrote:
>>> and the framing format is HTTP. I will need to type something like this:
>>>
>>>POST / HTTP/1.1^M
>>>Host: localhost^M
>>>Content-type: application/json^M
>>>Content-length: 5
srinivasan writes:
> Even after changing as per the below
> "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3"
> or:
> 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3'
> or:
> "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3"
>
> Still my output is:
> */dev/mmcblk1p1: LABEL="efi" UUID="108
bob gailer writes:
> 5:50 AM Dec 8, 2016 a post was made to this list - subject "Snakify -
> free introductory Python online course with exercises"
>
> Recently I was engaged by a student seeking help with some of the
> exercises. I found a number of issues at the snakify web site. Thus
> began
Grant Edwards writes:
> On 2018-08-20, Steven D'Aprano wrote:
>> On Mon, 20 Aug 2018 00:31:35 +, Steven D'Aprano wrote:
>>
>>> When I write bytes to stdout, why are they reversed?
>>
>> Answer: they aren't, use hexdump -C.
>
> One might think that dumping out bytes in the correct order ought
Mark Lawrence writes:
> On 22/07/18 14:51, Abdur-Rahmaan Janhangeer wrote:
>> except local vars
>>
>> Abdur-Rahmaan Janhangeer
>> https://github.com/Abdur-rahmaanJ
>> Mauritius
>>
>
> Python doesn't have variables, it has names.
I think we should cut beginners (and probably everyone) some slack
Brian Oney writes:
> On Fri, 2018-07-20 at 06:37 +, Steven D'Aprano wrote:
>> On Fri, 20 Jul 2018 08:25:04 +0200, Brian Oney via Python-list wrote:
>>
>> > PS: Can I twiddle bits in Python?
>>
>> Yes.
>>
>> These operators work on ints:
>>
>> bitwise AND: &
>> bitwise OR: |
>> bi
Just word on quoting...
codewiz...@gmail.com writes:
> On Thursday, July 12, 2018 at 5:45:52 AM UTC-4, Ben Bacarisse wrote:
>>
>> [snip]
You cut everything I wrote. What you left is what I quoted from the
Python documentation. In fairness to the authors you should probab
aleiphoenix writes:
> suppose following code running with Python-3.4.8 and Python-3.6.5
>
>
> # -*- coding: utf-8 -*-
>
>
> def hello():
> err = None
> print('0: {}'.format(locals()))
> try:
> b = 2
> print('1: {}'.format(locals()))
> raise ValueError()
>
To: Bart
From: "Ben Bacarisse"
To: Bart
From: Ben Bacarisse
Bart writes:
> On 23/06/2018 23:25, Ben Bacarisse wrote:
>> Bart writes:
>>
>>> On 23/06/2018 21:13, Chris Angelico wrote:
>>>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote:
>
To: Bart
From: "Ben Bacarisse"
To: Bart
From: Ben Bacarisse
Bart writes:
> On 23/06/2018 21:13, Chris Angelico wrote:
>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote:
>
>>> (At what point would that happen anyway; if you do this:
>
>> NONE o
To: Steven D'Aprano
From: "Ben Bacarisse"
To: Steven D'Aprano
From: Ben Bacarisse
Steven D'Aprano writes:
> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote:
>
>>>> The code page remark is curious. Will some "code pages" hav
To: Bart
From: Ben Bacarisse
Bart writes:
> On 23/06/2018 23:25, Ben Bacarisse wrote:
>> Bart writes:
>>
>>> On 23/06/2018 21:13, Chris Angelico wrote:
>>>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote:
>>>
>>>>> (At what poin
To: Bart
From: Ben Bacarisse
Bart writes:
> On 23/06/2018 21:13, Chris Angelico wrote:
>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote:
>
>>> (At what point would that happen anyway; if you do this:
>
>> NONE of your examples are taking copies of the fu
To: Steven D'Aprano
From: Ben Bacarisse
Steven D'Aprano writes:
> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote:
>
>>>> The code page remark is curious. Will some "code pages" have digits
>>>> that are not ASCII digits?
>>&g
Bart writes:
> On 23/06/2018 23:25, Ben Bacarisse wrote:
>> Bart writes:
>>
>>> On 23/06/2018 21:13, Chris Angelico wrote:
>>>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote:
>>>
>>>>> (At what point would that happen anyway; if you
Bart writes:
> On 23/06/2018 21:13, Chris Angelico wrote:
>> On Sat, Jun 23, 2018 at 10:41 PM, Bart wrote:
>
>>> (At what point would that happen anyway; if you do this:
>
>> NONE of your examples are taking copies of the function. They all are
>> making REFERENCES to the same function. That is
Steven D'Aprano writes:
> On Fri, 22 Jun 2018 11:14:59 +0100, Ben Bacarisse wrote:
>
>>>> The code page remark is curious. Will some "code pages" have digits
>>>> that are not ASCII digits?
>>>
>>> Good question. I have no idea.
&g
Ethan Furman writes:
> On 06/21/2018 01:20 PM, Ben Bacarisse wrote:
>> You say in a followup that you don't need to worry about digit grouping
>> marks (like thousands separators) so I'm not sure what the problem is.
>> Can't you just replace ',
Ethan Furman writes:
> I need to translate numeric data in a string format into a binary
> format. I know there are at least two different methods of
> representing parts less that 1, such as "10.5" and "10,5". The data
> is encoded using code pages, and can vary depending on the file being
>
Bart writes:
> On 18/06/2018 11:45, Chris Angelico wrote:
>> On Mon, Jun 18, 2018 at 8:33 PM, Bart wrote:
>
>
>>> You're right in that neither task is that trivial.
>>>
>>> I can remove comments by writing a tokeniser which scans Python source and
>>> re-outputs tokens one at a time. Such a toke
Cameron Simpson writes:
> ... In Python 3 we have "format strings", which let you write:
>
> name = "Sharon"
> age = 35
> print(f"The person named {name|r} is {age} years old.")
You meant {name!r} I think there.
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
Jon Ribbens writes:
> I'd suggest that since the processes he's purporting to disallow are
> entirely standard and automated and he knows full well they exist and
> that there is no mechanism by which they could be affected by his
> notice, the notice has little effect.
The Copyright notice is p
Paul Rubin writes:
> Steven D'Aprano writes:
>> it too will mess up sorting in unpredictable ways. So don't do that.
>
> Hmm. GHCi 7.4.2:
>
> Prelude> let x = 0.0 / 0.0
> Prelude> x
> NaN
> Prelude> x==x
> False
> Prelude> :m Data.List
> Prelude Data.List> sort [1,2,
Steven D'Aprano writes:
> On Wed, 30 May 2018 21:53:05 +0100, Ben Bacarisse wrote:
>
>> Rob Gaddi writes:
>>
>>> On 05/30/2018 09:34 AM, Paul Rubin wrote:
>>>> I think Usenet posts are no longer getting forwarded to the mailing
>>>> list,
Rob Gaddi writes:
> On 05/30/2018 09:34 AM, Paul Rubin wrote:
>> I think Usenet posts are no longer getting forwarded to the mailing
>> list, but now I wonder if this is getting out at all, even to usenet.
>>
>> Does anyone see it?
>
> Can't speak for the mailing list, but this came out to Usenet
Steven D'Aprano writes:
> On Thu, 24 May 2018 16:05:32 -0700, Paul wrote:
>
>> How would one make a multi-dimensional list now, with truly-separate sub
>> lists? Is there just no way to do it with the replication operator?
>
> Correct. Let's say you want to make a 1-D list with three items
> in
bartc writes:
> On 17/05/2018 23:49, Chris Angelico wrote:
>> On Fri, May 18, 2018 at 8:44 AM, Paul wrote:
>
>>> I've been using email for thirty years, including thousands of group emails
>>> at many tech companies, and no one has ever suggested, let alone insisted
>>> on, bottom posting. If s
Anders Wegge Keller writes:
> På Wed, 16 May 2018 14:48:27 +0100
> Paul Moore skrev:
>
>> C++ called that an "rvalue". And then went on to define things that
>> could go on the left hand side of an assignment as "lvalues". And now
>> we have two confusing concepts to explain - see what happens w
bartc writes:
> On 11/05/2018 01:25, Marko Rauhamaa wrote:
>> Chris Angelico :
>>
>>> Octal makes a lot of sense in the right contexts.
>>
>> I think octal is a historical relic from a time when people weren't yet
>> comfortable with hexadecimal.
>
> It's a relic from when machines had word sizes
ElChino writes:
> I'm trying to simplify a try-except construct. E.g. how come
> this:
> try:
> _x, pathname, _y = imp.find_module (mod, mod_path)
> return ("%s" % pathname)
> except ImportError:
> pass
> except RuntimeError:
> pass
> return ("")
>
> Cannot be simplified
David Foster writes:
> My understanding is that the Python interpreter already has enough
> information when bytecode-compiling a .py file to determine which
> names correspond to local variables in functions. That suggests it has
> enough information to identify all valid names in a .py file and
Johannes Bauer writes:
> On 30.03.2018 13:13, Ben Bacarisse wrote:
>
>>> import collections
>>>
>>> class Test(object):
>>> def __init__(self):
>>> z = {
>>> "y": colle
Johannes Bauer writes:
> I stumbled about something that I cannot quite explain while doing some
> stupid naming of variables in my code, in particular using "collections"
> as an identifier. However, what results is strange. I've created a
> minimal example. Consider this:
>
> import collections
Lawrence D’Oliveiro writes:
> On Thursday, March 15, 2018 at 2:56:24 PM UTC+13, Ben Bacarisse wrote:
>>
>> Lawrence D’Oliveiro writes:
>>
>>> On Wednesday, March 14, 2018 at 2:18:24 PM UTC+13, Ben Bacarisse wrote:
>>>
>>>> Lawrence D’Oliveiro
Lawrence D’Oliveiro writes:
> On Wednesday, March 14, 2018 at 2:18:24 PM UTC+13, Ben Bacarisse wrote:
>> Lawrence D’Oliveiro writes:
>>
>> The original problem -- triples of natural numbers -- is
>> not particularly hard, but the general problem -- enumerating n-tuple
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
Lawrence D’Oliveiro writes:
> On Sunday, March 11, 2018 at 2:40:16 PM UTC+13, Ben Bacarisse wrote:
>> It would be nice to avoid relying on any value-based ordering.
>
> I don’t see why. The set of elements has to have the same cardinality
> as the set of natural numbers, after
Lawrence D’Oliveiro writes:
> On Sunday, March 11, 2018 at 3:24:05 AM UTC+13, Ben Bacarisse wrote:
>> Unfortunately my Python is not up to using iterators well enough to
>> avoid a "maximum recursion depth exceeded" error.
>
> My solution only needed recursion up
bartc writes:
> On 10/03/2018 20:06, Ben Bacarisse wrote:
>>> On 10/03/2018 14:23, Ben Bacarisse wrote:
>>>> Off topic: I knocked up this Haskell version as a proof-of-concept:
>>>>
>>>> import Data.List
>>>>
>>>> p
bartc writes:
> [repost as original seems to have gone to email; my newsreader has
> somehow acquired a 'Reply' button where 'Followup' normally goes.]
[I thought it was intended but my reply bounced.]
> On 10/03/2018 14:23, Ben Bacarisse wrote:
>> Ben B
Sorry for following up to myself again...
Ben Bacarisse writes:
>> ... But I think that is an easier way (no code yet though!) unless
>> you are set on one particular enumeration: consider the triple as a pair
>> one element of which runs over the enumeration of pairs y
Ben Bacarisse writes:
> Steven D'Aprano writes:
>
>> I am trying to enumerate all the three-tuples (x, y, z) where each of x,
>> y, z can range from 1 to ∞ (infinity).
> ... But I think that is an easier way (no code yet though!) unless
> you are set on one par
Steven D'Aprano writes:
> 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):
> prin
Christian Gollwitzer writes:
> George Marsaglia is a researcher who invented a couple of PRNGs which
> are both simple (one of the first was called KISS) yet surprisingly
> good.
s/is/was/
Sadly, he died a few years ago (2011).
--
Ben.
--
https://mail.python.org/mailman/listinfo/python-list
bartc writes:
> A C version is given below. (One I may have messed around with, which
> I'm not sure works properly. For an original, google for Marsaglia and
> KISS64 or SUPRKISS64.)
The version I know uses unsigned integers. Did you change then to signed?
For a Python version, go back to the
Steven D'Aprano writes:
> On Fri, 23 Feb 2018 00:26:33 +, bartc wrote:
>
>> The point of the article was Julia vs. Python. You can't make Python
>> faster by switching to a faster algorithm; you have to use the same one
>> on both.
>
> No, the point of the article was to write Python code tha
Lawrence D’Oliveiro writes:
> On Wednesday, February 21, 2018 at 3:10:25 AM UTC+13, Ben Bacarisse wrote:
>> You almost never /have/ to use nested loops. Has the course got this
>> far without introducing the idea of a function?
>
> If you are using a function to avoid a
Marc Cohen writes:
> USING PYTHON 2:
Why is that?
> Write a program to play this game. This may seem tricky, so break it
> down into parts. Like many programs, we have to use nested loops (one
> loop inside another). In the outermost loop, we want to keep playing
> until we are out of stones.
Marko Rauhamaa writes:
> Many people think static typing is key to high quality. I tend to think
> the reverse is true: the boilerplate of static typing hampers
> expressivity so much that, on the net, quality suffers.
I don't find that with Haskell. It's statically typed but the types are
almo
bartc writes:
> On 31/12/2017 22:09, Ben Bacarisse wrote:
>
>> No, you missed the point and did not address the question. You said (now
>> cut)
>>
>> | If I thought introducing functions, whether local or not, as a way of
>> | avoiding goto was worth doing, I
1 - 100 of 271 matches
Mail list logo