This will help you
http://net-informations.com/python/basics/string.htm
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Sep 18, 2017 at 1:23 PM, Steve D'Aprano
wrote:
> On Mon, 18 Sep 2017 11:11 am, Rick Johnson wrote:
>
>> Speaking in _keystrokes_, and that's what really matters
>> here, a print function is always three more keystrokes than
>> a print statement.
>
> Keystrokes only matter if you are hunt'n
On Mon, 18 Sep 2017 11:11 am, Rick Johnson wrote:
> Speaking in _keystrokes_, and that's what really matters
> here, a print function is always three more keystrokes than
> a print statement.
Keystrokes only matter if you are hunt'n'peck typing and need to pause between
holding down the shift key
On 2017-09-18 01:41, INADA Naoki wrote:
> > > That said, I'm neither here nor there when it comes to
> > > using print-as-a-statement vs print-as-a-function. I like
> > > the consistency it brings to the language, but miss the
> > > simplicity that Py2 had for new users. I'd almost want to
> > >
On Mon, 18 Sep 2017 07:37 am, Rick Johnson wrote:
> Consider the collowing code:
>
> if bool(someObject) == True:
> # Do something
>
> Yes, from a "byte-code perspective", this source code is
> superfluous,
This is bad code because it is bad SOURCE CODE. The byte code is ir
>
> >
> > I would agree that testing any of those for '== True' or
> > the like is pointless redundancy,
>
> But what's wrong with syntactical redundancy when it brings
> _clarity_ to the source code? And why can't Python be smart?
> Consider the collowing code:
>
> if bool(someObject) == True:
>
>
> > That said, I'm neither here nor there when it comes to
> > using print-as-a-statement vs print-as-a-function. I like
> > the consistency it brings to the language, but miss the
> > simplicity that Py2 had for new users. I'd almost want to
> > get it back as a feature of the REPL, even if
On Mon, 18 Sep 2017 09:15 am, Rick Johnson wrote:
> On Sunday, September 17, 2017 at 9:42:34 AM UTC-5, Steve D'Aprano wrote:
>> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
>>
>> [Snip: Reasons why print function is better than print statement]
>>
>> I've wanted to do all those things, and mo
MRAB wrote:
> Rick Johnson wrote:
> > Steve D'Aprano wrote:
> >> Tim Golden wrote:
> > >
> > > [Snip: Reasons why print function is better than print statement]
> > >
> > > I've wanted to do all those things, and more. I love the
> > > new print function. For the cost of one extra character,
> >
> On Sep 17, 2017, at 2:19 PM, Ned Batchelder wrote:
>
>> On 9/16/17 1:38 AM, Steve D'Aprano wrote:
>> /rant on
>>
>> So apparently everyone who disagrees that Python should be more like
>> Javascript
>> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids
>> --
>> and i
On 2017-09-17 16:15, Rick Johnson wrote:
> > I've wanted to do all those things, and more. I love the
> > new print function. For the cost of one extra character,
> > the closing bracket,
>
> Oops, _two_ characters! What about the opening "bracket"?
>>> print(len('print "hello"'))
13
>>>
On 2017-09-18 00:15, Rick Johnson wrote:
On Sunday, September 17, 2017 at 9:42:34 AM UTC-5, Steve D'Aprano wrote:
On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
[Snip: Reasons why print function is better than print statement]
I've wanted to do all those things, and more. I love the
new print
On 9/17/2017 4:39 PM, Rick Johnson wrote:
My point is
that Python source code was meant to be "executable pseudo
code" (Python devs' words not mine!),
The coinage 'Executable pseudocode' was my description of Python on
comp.lang.python, mirrored to this list, in April 1997, long before
I beca
Steve D'Aprano wrote:
> Tim Chase wrote:
>
> > On 2017-09-18 00:42, Steve D'Aprano wrote:
> > > On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
> > > Presumably you've never wanted to print to something
> > > other than std.out. The syntax in Python 2 is horrid:
> > >
> > > print >>sys.stderr, ar
Matt wrote:
Hi Leam-
>
> Targeting Python 2.6 for deployment on RHEL/CentOS 6 is a perfectly
> valid use case, and after the recent discussions in multiple threads
> (your "Design: method in class or general function?" and INADA Naoki's
> "People choosing Python 3"), I doubt it would be very usefu
Tim Chase wrote:
> Steve D'Aprano wrote:
> > Tim Golden wrote:
> > Presumably you've never wanted to print to something other
> > than std.out. The syntax in Python 2 is horrid:
> >
> > print >>sys.stderr, args
>
> For those cases, the old syntax was sufficiently horrid
> that indeed I didn't us
On 2017-09-17 17:27, leam hall wrote:
>
> Ah! So this works in Py2:
>def __str__(self):
> name= self.name.encode("utf-8")
>
>
> It completely fails in Py3:
> PVT b'Lakeisha F\xc3\xa1bi\xc3\xa1n' 7966A4 [F] Age: 22
>
>
> Note that moving __str__() to display() gets the same result
On Sunday, September 17, 2017 at 9:42:34 AM UTC-5, Steve D'Aprano wrote:
> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
>
> [Snip: Reasons why print function is better than print statement]
>
> I've wanted to do all those things, and more. I love the
> new print function. For the cost of one e
Steve D'Aprano wrote:
> ROGER GRAYDON CHRISTMAN wrote:
[...]
> > And most definitely if x is assigned outside my control, I
> > would definitely want some way to test or verify x's type
> > before I start using it, lest my random number generator
> > with its (A + B * C) % D finds itself conc
On Wed, Sep 13, 2017 at 5:39 PM, Sean DiZazzo wrote:
> On Wednesday, September 13, 2017 at 12:06:20 PM UTC-7, larry@gmail.com
> wrote:
>> I have a script that creates a tmp dir, create a lot of files in it,
>> and when done, does a rmtree on the dir. When it does that I get this
>> message:
>
ROGER GRAYDON CHRISTMAN wrote:
[Note: RODGER's words have been edited for clarity, and hopefully he won't
mind.]
> I have not yet mastered how to respond to a particular note
> in a thread with the mailer that I use, so this is not in
> response to anyone in particular, but just to some of t
On Sun, Sep 17, 2017 at 3:27 PM, Peter Otten <__pete...@web.de> wrote:
> leam hall wrote:
>
> > Doesn't seem to work. The failing code takes the strings as is from the
> > database. it will occasionally fail when a name comes up that uses
> > a non-ascii character.
>
> Your problem in nuce: the Py
On 9/16/17 1:38 AM, Steve D'Aprano wrote:
/rant on
So apparently everyone who disagrees that Python should be more like Javascript
is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids --
and is also too stupid to know how dumb they are.
"Hi, I've been programming in Pytho
On 2017-09-17 14:16, bartc wrote:
> print() is used for its side-effects; what relevant value does it
> return?
depending on the sink, errors can be returned (at least for the
printf(3) C function). The biggest one I've encountered is writing
to a full disk. The return value is how many characte
Larry Hudson wrote:
> ROGER GRAYDON CHRISTMAN wrote:
[Note: RODGER's reply is slightly modified for clarity]
> > I have not yet mastered how to respond to a particular
> > note in a thread with the mailer that I use, so this is not
> > in response to anyone in particular, but just to some of
leam hall wrote:
> Doesn't seem to work. The failing code takes the strings as is from the
> database. it will occasionally fail when a name comes up that uses
> a non-ascii character.
Your problem in nuce: the Python 2 __str__() method must not return unicode.
>>> class Character:
... def _
On 2017-09-17 19:59, Chris Angelico wrote:
On Mon, Sep 18, 2017 at 4:35 AM, Steve D'Aprano
wrote:
So why doesn't it return a fractions.Fraction instead? That way, you
still get "one half" instead of zero, but it's guaranteed to be
accurate. And having 1/3 be a literal meaning "one third" would
On 09/16/2017 09:59 AM, Tim Daneliuk wrote:
> On 09/16/2017 12:38 AM, Steve D'Aprano wrote:
>> /rant on
>>
>> So apparently everyone who disagrees that Python should be more like
>> Javascript
>> is an old greybeard fuddy-duddy yelling "Get off my lawn!" to the cool kids
>> --
>> and is also too
On Mon, Sep 18, 2017 at 4:35 AM, Steve D'Aprano
wrote:
>> So why doesn't it return a fractions.Fraction instead? That way, you
>> still get "one half" instead of zero, but it's guaranteed to be
>> accurate. And having 1/3 be a literal meaning "one third" would avoid
>> all the problems of "1/3 + 1
On Mon, 18 Sep 2017 04:09 am, Tim Chase wrote:
> On 2017-09-18 00:42, Steve D'Aprano wrote:
>> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
>> Presumably you've never wanted to print to something other than
>> std.out. The syntax in Python 2 is horrid:
>>
>> print >>sys.stderr, args
>
> For t
On Mon, 18 Sep 2017 03:00 am, Chris Angelico wrote:
>> The distinction between Python floats and real numbers ℝ is a red-herring. It
>> isn't relevant.
>
> You said:
>
(I have a degree in maths, and if we ever
covered areas where int/int was undefined, it was only briefly, and I've
>>>
On Sun, 17 Sep 2017 08:45:27 +0400, Abdur-Rahmaan Janhangeer wrote:
> by widget["width"] i meant replace widget with your widget
Yes, that is what I did. It returned 0.
--
GNU/Linux user #557453
The cow died so I don't need your bull!
--
https://mail.python.org/mailman/listinfo/python-list
On 2017-09-18 00:42, Steve D'Aprano wrote:
> On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
> Presumably you've never wanted to print to something other than
> std.out. The syntax in Python 2 is horrid:
>
> print >>sys.stderr, args
For those cases, the old syntax was sufficiently horrid that ind
On Mon, Sep 18, 2017 at 2:20 AM, leam hall wrote:
> On Sun, Sep 17, 2017 at 9:13 AM, Peter Otten <__pete...@web.de> wrote:
>
>> Leam Hall wrote:
>>
>> > On 09/17/2017 08:30 AM, Chris Angelico wrote:
>> >> On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall wrote:
>> >>> Still trying to keep this Py2 and P
On Sun, Sep 17, 2017 at 11:03 PM, Steve D'Aprano
wrote:
> On Sun, 17 Sep 2017 08:43 pm, Chris Angelico wrote:
>
>> On Sun, Sep 17, 2017 at 5:54 PM, Steve D'Aprano
>> wrote:
>>> To even *know* that there are branches of maths where int/int isn't defined,
>>> you need to have learned aspects of mat
On Sun, Sep 17, 2017 at 9:13 AM, Peter Otten <__pete...@web.de> wrote:
> Leam Hall wrote:
>
> > On 09/17/2017 08:30 AM, Chris Angelico wrote:
> >> On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall wrote:
> >>> Still trying to keep this Py2 and Py3 compatible.
> >>>
> >>> The Py2 error is:
> >>>
On Sun, Sep 17, 2017 at 11:44 AM, Dennis Lee Bieber
wrote:
> The only pocket calculators I know of that have "integers" are those
> with a "programmer's mode" -- ie; binary (displayed in
> binary/octal/decimal/hex) but needing to be converted back to "normal" if
> one wants to use them wit
On 17/09/2017 15:42, Steve D'Aprano wrote:
On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
Print-as-a-function removed one small simplicity
Presumably you've never wanted to print to something other than std.out.
Actually, no. (stderror is either a Unix-ism or C-ism, or some combination).
On Sun, 17 Sep 2017 11:51 pm, Tim Golden wrote:
> Print-as-a-function removed one small simplicity
Presumably you've never wanted to print to something other than std.out. The
syntax in Python 2 is horrid:
print >>sys.stderr, args
Presumably you've never wanted to print using a separator other
print >>sys.stderr, 'learn special syntax only for print?'
print('you can use keword argument not only print', file=sys.stderr)
p = functools.partial(print, file=sys.stderr)
p('you can use other mechanizms for function')
I never want to teach >> syntax for new people.
On 2017年9月17日(日) 22:55 Abdu
ah the only thing i miss in py2 very sad and it was a well heralded arg in
favour of py
print "i miss you simple print"
Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com
On 17 Sep 2017 17:50, "Tim Golden" wrote:
>
>
> On 17/09/2017 14:34, breamore...@gmail.com wrote:
>
>
>
>
> I am interested in the testbank for this book. What is the price ?
Don't encourage spammers
--
California, n.:
From Latin "calor", meaning "heat" (as in English "calorie" or
Spanish "caliente"); and "fornia'" for "sexual intercourse" or
"fornication." Hence: Tierra de California, "
On 17/09/2017 14:34, breamore...@gmail.com wrote:
On Sunday, September 17, 2017 at 2:16:48 PM UTC+1, bartc wrote:
print can also be used for debugging, when it might be written, deleted
and added again hundreds of times. So writing all those brackets becomes
irksome. 'print' needs to be easy
i use langages that uses py with
so you have to wrap things in a function so that it will be called
i'm tired telling beginners : hey don't forget to declare your globals
don't forget don't forget and most of the time there are many ...
well they just can't declare it in the func as they ha
On Sun, Sep 17, 2017 at 9:34 AM, wrote:
> Experienced Python programmers use the logging module for debugging, write
> once, delete (maybe) never.
I use pdb for debugging (but I also log a lot which helps with prod
system when users report a problem).
--
https://mail.python.org/mailman/listinf
On Sunday, September 17, 2017 at 2:16:48 PM UTC+1, bartc wrote:
>
> print can also be used for debugging, when it might be written, deleted
> and added again hundreds of times. So writing all those brackets becomes
> irksome. 'print' needs to be easy to write.
>
> --
> bartc
Experienced Pytho
On 17/09/2017 02:09, Steve D'Aprano wrote:
On Sun, 17 Sep 2017 04:00 am, Stefan Ram wrote:
Steve D'Aprano writes:
"Hi, I've been programming in Python for what seems like days now, and here's
all the things that you guys are doing wrong.
I never ever have written a line of Python 2. I st
Leam Hall wrote:
> On 09/17/2017 08:30 AM, Chris Angelico wrote:
>> On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall wrote:
>>> Still trying to keep this Py2 and Py3 compatible.
>>>
>>> The Py2 error is:
>>> UnicodeEncodeError: 'ascii' codec can't encode character
>>> u'\xf6' in posit
On Sun, 17 Sep 2017 08:43 pm, Chris Angelico wrote:
> On Sun, Sep 17, 2017 at 5:54 PM, Steve D'Aprano
> wrote:
>> To even *know* that there are branches of maths where int/int isn't defined,
>> you need to have learned aspects of mathematics that aren't even taught in
>> most undergrad maths degr
On 09/17/2017 08:30 AM, Chris Angelico wrote:
On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall wrote:
Still trying to keep this Py2 and Py3 compatible.
The Py2 error is:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6'
in position 8: ordinal not in range(128)
even
On Sun, Sep 17, 2017 at 9:38 PM, Leam Hall wrote:
> Still trying to keep this Py2 and Py3 compatible.
>
> The Py2 error is:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6'
> in position 8: ordinal not in range(128)
>
> even when the string is manually converted:
On 17 September 2017 at 12:38, Leam Hall wrote:
> On 09/17/2017 07:25 AM, Steve D'Aprano wrote:
>>
>> On Sun, 17 Sep 2017 08:03 pm, Leam Hall wrote:
>>
>>> I'm still trying to figure out how to convert a string to unicode in
>>> Python 2.
>>
>>
>>
>> A Python 2 string is a string of bytes, so you
On 09/17/2017 07:25 AM, Steve D'Aprano wrote:
On Sun, 17 Sep 2017 08:03 pm, Leam Hall wrote:
I'm still trying to figure out how to convert a string to unicode in
Python 2.
A Python 2 string is a string of bytes, so you need to know what encoding they
are in. Let's assume you got them from a
On Sun, 17 Sep 2017 08:03 pm, Leam Hall wrote:
> I'm still trying to figure out how to convert a string to unicode in
> Python 2.
A Python 2 string is a string of bytes, so you need to know what encoding they
are in. Let's assume you got them from a source using UTF-8. Then you would do:
mystri
On Sun, 17 Sep 2017 08:02 pm, Abdur-Rahmaan Janhangeer wrote:
> as someone who really dislike js, i have to admit : python's globals are
> really really bad !
>
> js is a charm at that a real charm !
Can you explain what you think is so bad about them, and why Javascript's are
better?
--
Ste
On Sun, Sep 17, 2017 at 5:54 PM, Steve D'Aprano
wrote:
> To even *know* that there are branches of maths where int/int isn't defined,
> you
> need to have learned aspects of mathematics that aren't even taught in most
> undergrad maths degrees. (I have a degree in maths, and if we ever covered
>
Hmm... scratch the "young" and "Javascripters". Why lump them together
since I bet it's just a vocal few? Better to have said "people who don't
want to really learn the new language".
On 09/17/2017 06:03 AM, Leam Hall wrote:
Different view, I guess. I'm glad all the young Javascripters have tha
Hello all.
I'm on Linux Mint 18.2 Cinnamon 64-bit.
I am trying to get IBM Watson BlueMix Speech-To-Text to transcribe my
spoken-word audio files. Because I'm not a coder, I tried to find the
simplest way to use BlueMix Speech-to-Text. And what I found
is [1]https://github.com/r
as someone who really dislike js, i have to admit : python's globals are
really really bad !
js is a charm at that a real charm !
Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com
On 16 Sep 2017 09:40, "Steve D'Aprano" wrote:
> /rant on
>
> So apparently everyone who dis
Different view, I guess. I'm glad all the young Javascripters have that
issue. As an old guy trying to re-learn more python it gives me an
advantage. I'm usually interested in the best thislanguage-native way to
do something. Doing so makes me learn the language faster and tends to
generate bet
In case you haven't heard about this:
https://developers.slashdot.org/story/17/09/16/2030229/pythons-official-repository-included-10-malicious-typo-squatting-modules
Here is the Slashdot summary:
| The Slovak National Security Office (NBU) has identified ten malicious
| Python libraries uploade
Le 15 sept. 2017 20:05, "Stefan Ram" a écrit :
When one is building an in-memory database that has a single
table that is built at the start of the program and then one
writes some complex queries to the table, what can be expected
to be faster:
- implementing the table as a builtins
On Sun, 17 Sep 2017 04:16 pm, Terry Reedy wrote:
> On 9/17/2017 2:04 AM, Chris Angelico wrote:
>> On Sun, Sep 17, 2017 at 4:00 PM, Terry Reedy wrote:
>>> The numerical extensions have been quasi-official in the sense that at least
>>> 3 language enhancements have been make for their use.
>>
>> I
On Sun, 17 Sep 2017 02:07 pm, Paul Rubin wrote:
> Steve D'Aprano writes:
>>> concept integer / integer => integer_result
>> That would be C, and C derived languages, perhaps?
>
> Certainly not. Fortran, machine languages, etc. all do that too.
>
> Haskell does the right thing and
On 16/09/2017 17:52, Dennis Lee Bieber wrote:
On Sat, 16 Sep 2017 09:59:43 -0500, Tim Daneliuk
declaimed the following:
Well, the whole integer floor division thing years ago was the beginning
of the end - Python was doomed ...
Yes -- that would give me fits if I were using Python3
65 matches
Mail list logo