On 20/11/2018 22:35, Steven D'Aprano wrote:
> On Tue, Nov 20, 2018 at 08:22:01PM +, Alan Gauld via Tutor wrote:
>
>> I think that's a very deliberate feature of Python going back
>> to its original purpose of being a teaching language that
>> can be used beyond the classroom.
>
> I don't thin
On Tue, Nov 20, 2018 at 08:22:01PM +, Alan Gauld via Tutor wrote:
> I think that's a very deliberate feature of Python going back
> to its original purpose of being a teaching language that
> can be used beyond the classroom.
I don't think that is correct -- everything I've read is that Guido
On 20/11/2018 18:08, Avi Gross wrote:
We have two completely separate ways to format strings that end up with fairly
similar functionality. Actually, there is an implicit third way 😊
You could argue five ways :-)
1. C printf style formatting
https://docs.python.org/3/library/stdtypes.html
On 20/11/2018 18:08, Avi Gross wrote:
> ... So there isn’t really ONE pythonic way for many things.
That's true and, I think, inevitable for anything developed
in the open source world. If you compare it to a language
entirely controlled by a single mind - like Oberon or Eiffel
say - then there i
This is not a question or reply. Nor is it short. If not interested, feel free
to delete.
It is an observation based on recent experiences.
We have had quite a few messages that pointed out how some people approach
solving a problem using subconscious paradigms inherited from their past.
On 27/01/12 06:44, Andre' Walker-Loud wrote:
... I have only had one programming class, and that was 15 years ago or so,
> ...so these are not issues I am aware of.
I often find myself joining strings (and have mostly used + to do it).
String addition is OK in some languages, or at least bet
On 27/01/2012 06:44, Andre' Walker-Loud wrote:
Hi Steven,
(5) When assembling strings from substrings, never use repeated concatenation
using + as that can be EXTREMELY slow. Use str.join to build the string in one
assignment, instead of multiple assignments.
Your code shown above is *very*
Hi Steven,
> (5) When assembling strings from substrings, never use repeated concatenation
> using + as that can be EXTREMELY slow. Use str.join to build the string in
> one assignment, instead of multiple assignments.
>
> Your code shown above is *very* inefficient and will be PAINFULLY slow i
Hello Steven,
Thanks a lot for the detailed answer. I will implement your suggestions.
Really appreciate it.
Thanks and Regards,
Sumod
On Fri, Jan 27, 2012 at 4:34 AM, Steven D'Aprano wrote:
> spa...@gmail.com wrote:
>
>> Hello,
>>
>> My code is -
>>
>> l = len(m)
>> item = str(m[1])
>> for i i
spa...@gmail.com wrote:
Hello,
My code is -
l = len(m)
item = str(m[1])
for i in range(2,l):
item = item + "-" + str(m[i])
This code is part of a bigger function. It works fine. But I am not happy
with the way I have written it. I think there is a better (Pythonic) way to
rewrite it.
If an
Hello,
My code is -
l = len(m)
item = str(m[1])
for i in range(2,l):
item = item + "-" + str(m[i])
This code is part of a bigger function. It works fine. But I am not happy
with the way I have written it. I think there is a better (Pythonic) way to
rewrite it.
If anyone knows how to improve
Le Fri, 08 May 2009 13:03:47 -0400,
pyt...@bdurham.com s'exprima ainsi:
[...]
> Approaches:
> 1. split text to list of lines that get stripped then:
> a. walk this list building a new list of lines that track and
> ignore extra blank lines
> -OR-
> b. re-join lines and replace '\n\n\n' wth' \n\n'
On Fri, May 8, 2009 at 1:03 PM, wrote:
> Note: Following cross-posted to python-list where it got queued due to
> suspicious subject line.
>
> I'm looking for suggestions on technique (not necessarily code) about the
> most pythonic way to normalize vertical whitespace in blocks of text so that
>
pyt...@bdurham.com wrote:
Note: Following cross-posted to python-list where it got queued due to
suspicious subject line.
I'm looking for suggestions on technique (not necessarily code) about
the most pythonic way to normalize vertical whitespace in blocks of
text so that there is never more
Note: Following cross-posted to python-list where it got queued
due to suspicious subject line.
I'm looking for suggestions on technique (not necessarily code)
about the most pythonic way to normalize vertical whitespace in
blocks of text so that there is never more than 1 blank line
between paragr
"Malcolm Greene" <[EMAIL PROTECTED]> wrote in
> Background: I have a long multi-line string with expressions
> delimited
> with '<(' and ')>' markers. I would like to extract these substrings
> and
> process them in a loop.
>
> I know how to do this task with regular expressions, but I'm always
Malcolm Greene wrote:
> Suggestions on the best way to extract delimited substrings strings from
> a larger string?
>
> Background: I have a long multi-line string with expressions delimited
> with '<(' and ')>' markers. I would like to extract these substrings and
> process them in a loop.
> Wha
Suggestions on the best way to extract delimited substrings strings from
a larger string?
Background: I have a long multi-line string with expressions delimited
with '<(' and ')>' markers. I would like to extract these substrings and
process them in a loop.
Because the left and right delimiters a
On Friday 26 October 2007 03:17:47 pm Alan Gauld wrote:
> "Allen Fowler" <[EMAIL PROTECTED]> wrote
>
> > I have a block of code buried deep in a module
> > that I expect to fail periodically.
> > (Calls to other machines over slow network, and such.)
> >
> > Generally, though, trying it a second /
"Allen Fowler" <[EMAIL PROTECTED]> wrote
> I have a block of code buried deep in a module
> that I expect to fail periodically.
> (Calls to other machines over slow network, and such.)
>
> Generally, though, trying it a second / third will work.
>
> Is there clean way to write this on Python
Hello,
I have a block of code buried deep in a module that I expect to fail
periodically. (Calls to other machines over slow network, and such.)
Generally, though, trying it a second / third will work.
Is there clean way to write this on Python?
Thanks
_
21 matches
Mail list logo