Re: What use of string module?

2017-09-17 Thread lingmaaki
This will help you http://net-informations.com/python/basics/string.htm -- https://mail.python.org/mailman/listinfo/python-list

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
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 > > >

Re: [Tutor] beginning to code

2017-09-17 Thread Steve D'Aprano
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

Re: [Tutor] beginning to code

2017-09-17 Thread INADA Naoki
> > > > > 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:

Re: Old Man Yells At Cloud

2017-09-17 Thread INADA Naoki
> > > > 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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
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, > >

Re: Old Man Yells At Cloud

2017-09-17 Thread Christopher Reimer
> 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

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
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 >>>

Re: Old Man Yells At Cloud

2017-09-17 Thread MRAB
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

Re: [Tutor] beginning to code

2017-09-17 Thread Terry Reedy
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
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

Re: Unicode

2017-09-17 Thread leam hall
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
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

Re: Unicode

2017-09-17 Thread Matt Ruffalo
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Rick Johnson
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

Re: [Tutor] beginning to code

2017-09-17 Thread Rick Johnson
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

Re: rmtree message

2017-09-17 Thread Larry Martell
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: >

Re: [Tutor] beginning to code

2017-09-17 Thread Rick Johnson
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

Re: Unicode

2017-09-17 Thread leam hall
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Ned Batchelder
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
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

Re: [Tutor] beginning to code

2017-09-17 Thread Rick Johnson
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

Re: Unicode

2017-09-17 Thread Peter Otten
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 _

Re: Old Man Yells At Cloud

2017-09-17 Thread MRAB
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Daneliuk
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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 >>>

Re: ttk.Notebook Tabs Question

2017-09-17 Thread Wildman via Python-list
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Chase
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

Re: Unicode

2017-09-17 Thread Chris Angelico
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
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

Re: Unicode

2017-09-17 Thread leam hall
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: > >>>

Re: Old Man Yells At Cloud

2017-09-17 Thread Larry Martell
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

Re: Old Man Yells At Cloud

2017-09-17 Thread bartc
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).

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread INADA Naoki
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Abdur-Rahmaan Janhangeer
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: > >

Re: Test Bank for Governing Texas, 3rd Edition by Champagne Harpham

2017-09-17 Thread alister via Python-list
> > > 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, "

Re: Old Man Yells At Cloud

2017-09-17 Thread Tim Golden
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

Re: Python built-ins versus Javascript [was Re: Old Man Yells At Cloud]

2017-09-17 Thread Abdur-Rahmaan Janhangeer
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Larry Martell
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

Re: Old Man Yells At Cloud

2017-09-17 Thread breamoreboy
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

Re: Old Man Yells At Cloud

2017-09-17 Thread bartc
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

Re: Unicode

2017-09-17 Thread Peter Otten
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Re: Unicode

2017-09-17 Thread Leam Hall
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

Re: Unicode (was: Old Man Yells At Cloud)

2017-09-17 Thread Chris Angelico
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:

Re: Unicode (was: Old Man Yells At Cloud)

2017-09-17 Thread Paul Moore
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

Unicode (was: Old Man Yells At Cloud)

2017-09-17 Thread Leam Hall
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Python built-ins versus Javascript [was Re: Old Man Yells At Cloud]

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Chris Angelico
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 >

Re: Old Man Yells At Cloud

2017-09-17 Thread Leam Hall
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

speech_to_text python command not working

2017-09-17 Thread pizza python
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Abdur-Rahmaan Janhangeer
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Leam Hall
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

Typo-squatting PyPi

2017-09-17 Thread Alain Ketterlin
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

Re: Which database system?

2017-09-17 Thread Amirouche Boubekki
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

Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread Steve D'Aprano
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

Re: Old Man Yells At Cloud

2017-09-17 Thread mm0fmf
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