On Thu, May 10, 2018 at 11:45 PM, Steven D'Aprano
wrote:
> To be honest, I'm having trouble thinking of a good use-case for "while
> True", now that we have infinite iterators. Most cases of
>
> while True:
> x = get_item()
> if not x: break
> process(x)
>
> are better
On Thu, May 10, 2018 at 11:17 PM, Steven D'Aprano
wrote:
> To answer your question from a later post:
>
> In what way does "while True" in the general case pretend
> to be an infinite loop?
>
> It doesn't *pretend* to be an infinite loop. It *is* an infinite loop
> which breaks out early.
On Fri, May 11, 2018 at 1:38 PM, Cameron Simpson wrote:
> Returning to system() versus the subprocess module, there are other reasons
> to prefer the subprocess module. The biggest is that os.system() runs a
> shell command, a string passed to the programme /bin/sh. As such, that
> string is subje
On Mon, May 7, 2018 at 9:45 PM, Mikhail V wrote:
> Here is an idea for 'data object' a syntax.
> For me it is interesting, how would users find such syntax.
> I personally find that this should be attractive from users
> perspective.
> Main aim is more readable presenting of typical data chunks
>
On Fri, 11 May 2018 07:20:36 +, Bob Martin wrote:
> in 793605 20180511 044309 T Berger wrote:
>>On Saturday, May 5, 2018 at 6:45:46 PM UTC-4, MRAB wrote:
>>> On 2018-05-05 17:57, T Berger wrote:
>>> > What does the "p" in "plist" stand for? Is there a python glossary
>>> > that spells out the
in 793605 20180511 044309 T Berger wrote:
>On Saturday, May 5, 2018 at 6:45:46 PM UTC-4, MRAB wrote:
>> On 2018-05-05 17:57, T Berger wrote:
>> > What does the "p" in "plist" stand for?
>> > Is there a python glossary that spells out the meanings of abbreviated
>> > terms?
>> >
>> "plist" is "pro
On Thu, 10 May 2018 23:23:33 -0600, Ian Kelly wrote:
> On Thu, May 10, 2018 at 9:21 PM, Steven D'Aprano
> wrote:
>> On Thu, 10 May 2018 11:03:54 -0600, Ian Kelly wrote about proposed
>> prefixes for octal:
>>
>>> Personally I would have preferred the "t".
>>
>> "t" for octal, hey?
>>
>> That woul
On Thu, May 10, 2018 at 6:34 PM, Mikhail V wrote:
> On Wed, May 9, 2018 at 6:25 AM, Steven D'Aprano
> wrote:
>> On Tue, 08 May 2018 23:16:23 +0300, Mikhail V wrote:
>>
>
>>> but I propose Tab-separated elements.
>>
>> We already have tab-separated elements in Python. It is allowed to use
>> tabs
On Thu, 10 May 2018 20:38:39 -0600, Ian Kelly wrote:
> Would you also contend that generator functions are wrong because they
> pretend to be normal functions?
You're going to need to be more specific. In what way are they not normal
functions? You call them like normal functions, providing argu
On Fri, 11 May 2018 05:17:59 +, Steven D'Aprano wrote:
> On Fri, 11 May 2018 03:29:57 +0300, Marko Rauhamaa wrote:
[...]
> To answer your question from a later post:
>
> In what way does "while True" in the general case pretend to be an
> infinite loop?
Oops, sorry, that was Ian Kell
On Fri, 11 May 2018 01:51:47 +0300, Marko Rauhamaa wrote:
> Paul Rubin :
>
>> Marko Rauhamaa writes:
>>> It turns out "while True" is the most natural choice in about half of
>>> the while loops.
>>
>> Maybe the rest would be "repeat until" if Python had that?
>
> No. "Repeat until" is a relati
On Thursday 10 May 2018 23:21:11 Steven D'Aprano wrote:
> On Thu, 10 May 2018 11:03:54 -0600, Ian Kelly wrote about proposed
>
> prefixes for octal:
> > Personally I would have preferred the "t".
>
> "t" for octal, hey?
>
> That would be annoying if we ever get trinary literals.
>
> n for binary
>
On Thu, May 10, 2018 at 9:21 PM, Steven D'Aprano
wrote:
> On Thu, 10 May 2018 11:03:54 -0600, Ian Kelly wrote about proposed
> prefixes for octal:
>
>> Personally I would have preferred the "t".
>
> "t" for octal, hey?
>
> That would be annoying if we ever get trinary literals.
>
> n for binary
>
On 11May2018 06:53, Ganesh Pal wrote:
On Thu, May 10, 2018, 22:31 Rob Gaddi
By not using os.system, it's been superseded for reasons exactly like
yours. https://docs.python.org/3/library/subprocess.html is your friend.
Can someone please help me understand this better for me with a program .
On Fri, 11 May 2018 03:29:57 +0300, Marko Rauhamaa wrote:
>> Now do you understand what I mean about putting the condition into the
>> loop header?
>
> Thanks, but no thanks. The "while True" idiom beats that one hands down.
Why do you think it is better to lie to the reader and tell them they a
On Saturday, May 5, 2018 at 6:45:46 PM UTC-4, MRAB wrote:
> On 2018-05-05 17:57, T Berger wrote:
> > What does the "p" in "plist" stand for?
> > Is there a python glossary that spells out the meanings of abbreviated
> > terms?
> >
> "plist" is "property list". It's listed in the Python documentat
On Thu, 10 May 2018 22:59:03 +0300, Marko Rauhamaa wrote:
> It turns out "while True" is the most natural choice in
> about half of the while loops.
YMMV.
In my case, it is more like about one in ten.
--
Steve
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 10 May 2018 11:03:54 -0600, Ian Kelly wrote about proposed
prefixes for octal:
> Personally I would have preferred the "t".
"t" for octal, hey?
That would be annoying if we ever get trinary literals.
n for binary
t for octal
i for trinary
or should that be r for ternary?
o for duodecim
On Thu, 10 May 2018 17:36:39 +0100, bartc wrote:
> I wonder why someone would take a feature generally agreed to be a
> poorly designed feature of C, and incorporate it into a new language.
Because in 1991 or thereabouts, when Guido was designing the language for
the first time, he thought it wa
On Thu, May 10, 2018 at 6:36 PM, Gene Heskett wrote:
> On Thursday 10 May 2018 20:55:58 bartc wrote:
>
> > 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 pe
On Thu, May 10, 2018 at 7:10 PM, Chris Angelico wrote:
> On Fri, May 11, 2018 at 10:29 AM, Marko Rauhamaa wrote:
>> Chris Angelico :
>>
>>> But for the loop itself, you absolutely CAN write this more logically.
>>> I'll take your second version as a template:
>>>
>>> def split_cmd(self, cmd):
On Tue, May 8, 2018 at 11:50 PM, Chris Angelico wrote:
> On Wed, May 9, 2018 at 3:36 PM, Ian Kelly wrote:
>>
>> while True:
>> if we_are_done():
>> break
>> # do some stuff
>> ...
>> if error_occurred():
>> break
>> notify_user()
>>
>>
>> Fixed, using idiomatic Pyt
On Fri, May 11, 2018 at 11:36 AM, Gene Heskett wrote:
> So other than the *nix chmod, and some similar stuff in
> os9/nitros9/amigados, I have never had to deal with octal. I'm sure the
> security people would be pleased if another bit could be expanded into
> the permissions that chmod controls,
On Thursday 10 May 2018 20:55:58 bartc wrote:
> 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
On Thu, May 10, 2018, 22:31 Rob Gaddi
>
>
> By not using os.system, it's been superseded for reasons exactly like
> yours. https://docs.python.org/3/library/subprocess.html is your friend.
>
Can someone please help me understand this better for me with a program .
Will the returncode of subproc
On Fri, May 11, 2018 at 10:29 AM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> But for the loop itself, you absolutely CAN write this more logically.
>> I'll take your second version as a template:
>>
>> def split_cmd(self, cmd):
>> args = []
>> while (match := self.TERM_PTN.m
On Fri, May 11, 2018 at 10:25 AM, 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.
And any other situation where it makes more sense to group
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 that were multiples of
three bi
On Wed, May 9, 2018 at 6:25 AM, Steven D'Aprano
wrote:
> On Tue, 08 May 2018 23:16:23 +0300, Mikhail V wrote:
>
>> but I propose Tab-separated elements.
>
> We already have tab-separated elements in Python. It is allowed to use
> tabs between any whitespace separated tokens.
Yes, exactly. So in
Chris Angelico :
> But for the loop itself, you absolutely CAN write this more logically.
> I'll take your second version as a template:
>
> def split_cmd(self, cmd):
> args = []
> while (match := self.TERM_PTN.match(cmd)) is not None:
> args.append(match.group('ter
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.
> Allowing octal literals is a Good Thing.
I think it's just unavoidable mainly because of os.chmod.
Marko
--
https://mai
On Fri, May 11, 2018 at 8:49 AM, Marko Rauhamaa wrote:
> def split_cmd(self, cmd):
> args = []
> while True:
> match = self.TERM_PTN.match(cmd)
> if match is None:
> return None, None
> args.append(match.group('term'))
>
On Fri, May 11, 2018 at 8:43 AM, bartc wrote:
> This is Wrong, and would have been just as obviously wrong in 1989.
Having spent many years programming in C and working on Unix, I
strongly disagree. This was *not* obviously wrong. It's easy to say
"but look at the real world"; but in the 80s and
Paul Rubin :
> Marko Rauhamaa writes:
>> It turns out "while True" is the most natural choice in about half of
>> the while loops.
>
> Maybe the rest would be "repeat until" if Python had that?
No. "Repeat until" is a relatively infrequent need.
Marko
--
https://mail.python.org/mailman/listin
Chris Angelico :
> On Fri, May 11, 2018 at 5:59 AM, Marko Rauhamaa wrote:
>> Joking aside, to answer Chris's question, of course you can use a
>> real condition with "while". However, you shouldn't force it or try
>> to avoid "while True". It turns out "while True" is the most natural
>> choice in
On 10/05/2018 18:58, Skip Montanaro wrote:
I wonder why someone would take a feature generally agreed to be a
poorly designed feature of C, and incorporate it into a new language.
I think you might be looking at a decision made in the late 1980s through a
pair of glasses made in 2018.
As a C p
On Wed, 09 May 2018 12:51:15 -0700, Paul Rubin wrote:
> Dennis Lee Bieber writes:
>> Yes, code reviews may catch such errors... and later, when the
>> summary of errors is analyzed for suggestions on how to reduce them --
>> the odds are good that "assignment expressions" will be banned in th
On 10/05/2018 19:51, Chris Angelico wrote:
On Fri, May 11, 2018 at 4:31 AM, bartc wrote:
2x100 (4) Binary
3x100 (9) Ternary
4x100 (16) Quaternary
5x100 (25) etc
6x100 (36)
7x100 (49)
8x100 (64) Octal
9x100 (81)
... (Not implemented 11x to 15x,
> Bear in mind that Unix file modes are traditionally written in octal,
> because they have no meaning as numbers. They're more like
> enumerations, or bitfields.
The current chmod(2) man page says that the type of the second is mode_t,
but back in the early days, it appears it was just declared t
On Fri, May 11, 2018 at 5:59 AM, Marko Rauhamaa wrote:
> Mikhail V :
>
>> On Wed, May 9, 2018 at 8:50 AM, Chris Angelico wrote:
>>> On Wed, May 9, 2018 at 3:36 PM, Ian Kelly wrote:
while True:
>>>
>>> Why is it that "while True" is idiomatic Python for a non-infinite
>>> loop? Is it merely
Mikhail V :
> On Wed, May 9, 2018 at 8:50 AM, Chris Angelico wrote:
>> On Wed, May 9, 2018 at 3:36 PM, Ian Kelly wrote:
>>> while True:
>>
>> Why is it that "while True" is idiomatic Python for a non-infinite
>> loop? Is it merely because Python currently has no other way to spell
>> certain loo
On 2018-05-10, Jon Ribbens wrote:
> This whole thread is reminding me PHP 2, which would magically treat
> the second parameter of ChMod() as octal, because clearly if weak
> typing is good then *no* typing must be best of all!
>
> ChMod($filename, 644); // second parameter is actually 420 base
On 5/10/2018 2:12 PM, charmingold...@gmail.com wrote:
I'm learning to use TkInter in Python and came across this example program from
'Thinking in TkInter' (http://thinkingtkinter.sourceforge.net) - see below.
Two buttons 'button1' and 'button2' are defined. The bug is that event.widget
return
> This whole thread is reminding me PHP 2, which would magically treat
> the second parameter of ChMod() as octal, because clearly if weak
> typing is good then *no* typing must be best of all!
>ChMod($filename, 644); // second parameter is actually 420 base 10
I knew there was a reason I nev
On Fri, May 11, 2018 at 5:04 AM, Jon Ribbens wrote:
> On 2018-05-10, Skip Montanaro wrote:
>>> I wonder why someone would take a feature generally agreed to be a
>>> poorly designed feature of C, and incorporate it into a new language.
>>
>> I think you might be looking at a decision made in the
On 2018-05-10, Skip Montanaro wrote:
>> I wonder why someone would take a feature generally agreed to be a
>> poorly designed feature of C, and incorporate it into a new language.
>
> I think you might be looking at a decision made in the late 1980s through a
> pair of glasses made in 2018.
>
> As
On Fri, May 11, 2018 at 4:31 AM, bartc wrote:
> 2x100 (4) Binary
> 3x100 (9) Ternary
> 4x100 (16) Quaternary
> 5x100 (25) etc
> 6x100 (36)
> 7x100 (49)
> 8x100 (64) Octal
> 9x100 (81)
> ... (Not implemented 11x to 15x, nor 10x or 16x)
> 0x100 (256) Hex
On Wed, May 9, 2018 at 8:50 AM, Chris Angelico wrote:
> On Wed, May 9, 2018 at 3:36 PM, Ian Kelly wrote:
>>
>> while True:
>> if we_are_done():
>> break
>> # do some stuff
>> ...
>> if error_occurred():
>> break
>> notify_user()
>>
>>
>> Fixed, using idiomatic Pyth
On 10/05/18 19:10, richardchau...@gmail.com wrote:
On Thursday, May 10, 2018 at 1:54:11 PM UTC-4, Chris Angelico wrote:
I need to get some data from CME Group which provides a public API to download
(xsd)
What packages should I use in Python to access this data through this API.
Thank you.
On 10/05/2018 18:03, Ian Kelly wrote:
On Thu, May 10, 2018 at 10:36 AM, bartc wrote:
What, 0O100 instead of 0100? Yeah that's a big improvement...
Fortunately octal doesn't get used much.
The PEP discusses this:
"""
Proposed syntaxes included things like arbitrary radix prefixes, such
as 16
> I wonder why someone would take a feature generally agreed to be a
> poorly designed feature of C, and incorporate it into a new language.
I think you might be looking at a decision made in the late 1980s through a
pair of glasses made in 2018.
As a C programmer back then I never had a problem
I'm learning to use TkInter in Python and came across this example program from
'Thinking in TkInter' (http://thinkingtkinter.sourceforge.net) - see below.
Two buttons 'button1' and 'button2' are defined. The bug is that event.widget
returns '.!frame.!button' from a button1 event. i.e. it someho
On Thursday, May 10, 2018 at 1:54:11 PM UTC-4, Chris Angelico wrote:
> > I need to get some data from CME Group which provides a public API to
> > download (xsd)
> > What packages should I use in Python to access this data through this API.
> > Thank you.
>
> Depends a lot on the API, and I hav
On Fri, May 11, 2018 at 3:49 AM, wrote:
> I need to get some data from CME Group which provides a public API to
> download (xsd)
> What packages should I use in Python to access this data through this API.
> Thank you.
Depends a lot on the API, and I have no idea what CME Group is doing
(or wh
I need to get some data from CME Group which provides a public API to download
(xsd)
What packages should I use in Python to access this data through this API.
Thank you.
--
https://mail.python.org/mailman/listinfo/python-list
On 2018-05-10 18:03, Ian Kelly wrote:
On Thu, May 10, 2018 at 10:36 AM, bartc wrote:
What, 0O100 instead of 0100? Yeah that's a big improvement...
Fortunately octal doesn't get used much.
The PEP discusses this:
"""
Proposed syntaxes included things like arbitrary radix prefixes, such
as 16
On Thu, May 10, 2018 at 10:36 AM, bartc wrote:
> What, 0O100 instead of 0100? Yeah that's a big improvement...
>
> Fortunately octal doesn't get used much.
The PEP discusses this:
"""
Proposed syntaxes included things like arbitrary radix prefixes, such
as 16r100 (256 in hexadecimal), and radix
On Thu, May 10, 2018 at 5:49 AM, D'Arcy Cain wrote:
> On 2018-05-10 07:28 AM, Skip Montanaro wrote:
>> https://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax
>
> Funny stuff:
>
> Python could either:
>
> 1. silently do the wrong thing...
> 2. immediately disabuse him...
>
On 05/10/2018 09:48 AM, Ganesh Pal wrote:
I have to test a standalone tool from a python script and I am using
os.system() to run the tool . I need to take decision based on the return
value of the standalone tool .
But since os.system merely throws the output value to STDOUT & returns the
exit
On 05/10/2018 03:02 AM, bartc wrote:
On 10/05/2018 09:09, Marko Rauhamaa wrote:
bartc :
When typing in code (in various languages), I have a habit of typing
"..." at places that need to be implemented. For example:
if count:
...
else:
do_something_smart()
b
I have to test a standalone tool from a python script and I am using
os.system() to run the tool . I need to take decision based on the return
value of the standalone tool .
But since os.system merely throws the output value to STDOUT & returns the
exit status (0 => no error) of the shell , how c
On 10/05/2018 12:28, Skip Montanaro wrote:
This gave the following error:
Syntax Error: invalid token: C:\Users\Virgil Stokes\Desktop\Important
Notes_Files\CheckProcessingDate_02.py, line 7, pos 17
d0 = date(2018,02,01)
Note that this is a Python syntax error. It actually has nothing to do w
On 2018-05-10 13:52, D'Arcy Cain wrote:
On 2018-05-10 07:39 AM, AK wrote:
Try (should work from both PY2 and PY3):
d0 = date(2018,0o2,0o1)
Bad advice. Those numbers are decimal, not octal, You should use
"date(2018,2,1)" here. Works in PY2, PY3 and for my birthday, Sept 4.
It was only an
On 2018-05-10 07:28 AM, Skip Montanaro wrote:
> https://www.python.org/dev/peps/pep-3127/#removal-of-old-octal-syntax
Funny stuff:
Python could either:
1. silently do the wrong thing...
2. immediately disabuse him...
3. let him continue to think...
Some people passionately believe t
On 2018-05-10 07:39 AM, AK wrote:
> Try (should work from both PY2 and PY3):
>
> d0 = date(2018,0o2,0o1)
Bad advice. Those numbers are decimal, not octal, You should use
"date(2018,2,1)" here. Works in PY2, PY3 and for my birthday, Sept 4.
--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.Vy
On 2018-05-10 12:43, Virgil Stokes wrote:
Module info:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64
bit (AMD64)]
[...]
I tried first to use Python's built-in datetime module as follows:
from datetime import date, timedelta
d0 = date(2018,02,01)
This gave the fol
On Thu, 10 May 2018 12:43:33 +0200, Virgil Stokes wrote:
> Why does the datetime.date module (both built-in and site-package) not
> accept leading 0's?
This has nothing to do with the datetime module. Syntax Error means it it
prohibited by the language, not the module.
In Python 2, leading ze
>
> This gave the following error:
>
> Syntax Error: invalid token: C:\Users\Virgil Stokes\Desktop\Important
> Notes_Files\CheckProcessingDate_02.py, line 7, pos 17
> d0 = date(2018,02,01)
>
Note that this is a Python syntax error. It actually has nothing to do with
the datetime module. In Python
Module info:
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64
bit (AMD64)]
C:\Python36>pip show datetime
Name: DateTime
Version: 4.2
Summary: This package provides a DateTime data type, as known from Zope
2. Unless you need to communicate with Zope 2 APIs, you're probabl
bartc :
> I wondered what it meant, so I typed in:
>
>print (...)
>
> and it displayed:
>
>Ellipsis
>
> which wasn't very enlightening.
It doesn't mean anything for Python. It's just a special singleton
sentinel object that is stored in the predefined variable "Ellipsis" and
has a literal
On 10/05/2018 09:09, Marko Rauhamaa wrote:
bartc :
On 09/05/2018 06:44, Steven D'Aprano wrote:
But by the time 1.4 came around, Guido had settled on a clean separation
between statements and expressions as part of Python's design.
That separation has gradually weakened over the years,
Presum
Marko wrote:
> When typing in code (in various languages), I have a habit of typing
> "..." at places that need to be implemented
Quite a research area actually
https://wiki.haskell.org/GHC/Typed_holes
--
https://mail.python.org/mailman/listinfo/python-list
bartc :
> On 09/05/2018 06:44, Steven D'Aprano wrote:
>> But by the time 1.4 came around, Guido had settled on a clean separation
>> between statements and expressions as part of Python's design.
>>
>> That separation has gradually weakened over the years,
>
> Presumably it's non-existent now, as i
73 matches
Mail list logo