Re: Simple question - end a raw string with a single backslash ?

2021-04-24 Thread Peter J. Holzer
On 2020-10-19 06:24:18 -, Mladen Gogala via Python-list wrote: > On Mon, 19 Oct 2020 02:44:25 +, Stefan Ram wrote: > > Mladen Gogala writes: > >>In Perl, there are no classes. > > > > If there are no classes in Perl, then what does > > > > bless REF,CLASSNAME > > > > do? > > bles

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Eryk Sun
On 10/19/20, Grant Edwards wrote: > On 2020-10-19, Stephen Tucker wrote: > >> For a neatish way to get a string to end with a single backslash, how >> about >>mystr = r"abc\ "[:-1] >> (Note the space at the end of the rough-quoted string.) > > That's the first thing I thought of, though I wou

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Grant Edwards
On 2020-10-19, Stephen Tucker wrote: > For a neatish way to get a string to end with a single backslash, how about >mystr = r"abc\ "[:-1] > (Note the space at the end of the rough-quoted string.) That's the first thing I thought of, though I would probably use a non-space character to avoid

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Stephen Tucker
For a neatish way to get a string to end with a single backslash, how about mystr = r"abc\ "[:-1] (Note the space at the end of the rough-quoted string.) Virus-free. www.avast.com

Re: Simple question - end a raw string with a single backslash ?

2020-10-19 Thread Antoon Pardon
Op 13/10/20 om 15:14 schreef Serhiy Storchaka: 13.10.20 11:52, Tony Flury via Python-list пише: I am trying to write a simple expression to build a raw string that ends in a single backslash. My understanding is that a raw string should ignore attempts at escaping characters but I get this :

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Chris Angelico
On Mon, Oct 19, 2020 at 5:26 PM Mladen Gogala via Python-list wrote: > bless \$ref will make the given reference a reference to the class. And > classes is Perl > are called "modules". However, Perl classes are not the classes in the real > sense. There > is no inheritance. You can have a simil

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Mladen Gogala via Python-list
On Mon, 19 Oct 2020 02:44:25 +, Stefan Ram wrote: > Mladen Gogala writes: >>In Perl, there are no classes. > > If there are no classes in Perl, then what does > > bless REF,CLASSNAME > > do? bless \$ref will make the given reference a reference to the class. And classes is Perl are

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Michael Torrie
On 10/18/20 5:37 PM, Mladen Gogala via Python-list wrote: > On Sun, 18 Oct 2020 12:19:18 -0600, Michael Torrie wrote: > >> Python certainly is procedural. A script starts at the top and executes >> through to the bottom and ends, barring any flow control in the middle. >> Like Perl you can use i

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Mladen Gogala via Python-list
On Sun, 18 Oct 2020 12:19:18 -0600, Michael Torrie wrote: > Python certainly is procedural. A script starts at the top and executes > through to the bottom and ends, barring any flow control in the middle. > Like Perl you can use it in many different ways and paradigms including > OO if you desi

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Michael Torrie
On 10/18/20 11:07 AM, Mladen Gogala via Python-list wrote: > The fundamental > difference between the two languages is that Perl is procedural while > Python is a fully OO language. Discussion of Perl vs Python necessarily > devolves into the discussion of procedural vs OO paradigms. Python cert

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Mladen Gogala via Python-list
On Sun, 18 Oct 2020 16:13:16 +0200, Peter J. Holzer wrote: > > Ah, I see, that the sillyness of Perl's grammar-altering modules (which > let you write Perl in Latin (with proper declensions and conjugations, > of course) or Chinese) has found its way to Python > To tell the truth, I only instal

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Peter J. Holzer
On 2020-10-17 21:03:26 -, Mladen Gogala via Python-list wrote: > On Thu, 15 Oct 2020 21:30:15 +, Stefan Ram wrote: > > Tony Flury writes: > >> >>> a = r'end' + chr(92) > > > > Or maybe, > > > > a = r''' > > end\ > > '''[ 1: -1 ] > > > > ? The first and the last line are messy, but i

Re: Simple question - end a raw string with a single backslash ?

2020-10-17 Thread Mladen Gogala via Python-list
On Thu, 15 Oct 2020 21:30:15 +, Stefan Ram wrote: > Tony Flury writes: >> >>> a = r'end' + chr(92) > > Or maybe, > > a = r''' > end\ > '''[ 1: -1 ] > > ? The first and the last line are messy, but in the middle, > the intended string is clearly visible. You can use perl module for

Re: Simple question - end a raw string with a single backslash ?

2020-10-15 Thread Serhiy Storchaka
15.10.20 22:16, Roland Müller via Python-list пише: > I used the triple single quotes as delimiter: > s = r'''a single quote ', a double quote "''' s > > 'a single quote \', a double quote "' It does not help if the string contains both kinds of triple quotes You have to use triple

Re: Simple question - end a raw string with a single backslash ?

2020-10-15 Thread Roland Müller via Python-list
On 10/13/20 4:14 PM, Serhiy Storchaka wrote: 13.10.20 11:52, Tony Flury via Python-list пише: I am trying to write a simple expression to build a raw string that ends in a single backslash. My understanding is that a raw string should ignore attempts at escaping characters but I get this :   

Re: Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Serhiy Storchaka
13.10.20 11:52, Tony Flury via Python-list пише: > I am trying to write a simple expression to build a raw string that ends > in a single backslash. My understanding is that a raw string should > ignore attempts at escaping characters but I get this : > >     >>> a = r'end\' >       File "", line

Re: Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Eryk Sun
On 10/13/20, Tony Flury via Python-list wrote: > I am trying to write a simple expression to build a raw string that ends > in a single backslash. My understanding is that a raw string should > ignore attempts at escaping characters but I get this : > > >>> a = r'end\' >File "", line

Re: Simple question: how do I print output from .get() method

2018-05-30 Thread Rhodri James
On 30/05/18 06:51, Chris Angelico wrote: On Wed, May 30, 2018 at 3:44 PM, MrMagoo2018 wrote: Hello folks, imagine I have the code below and I am getting the "error" message when attempting to print() the output of 'sw_report'. Can you suggest which method I should use to retrieve this? Is that

Re: Simple question: how do I print output from .get() method

2018-05-29 Thread Chris Angelico
On Wed, May 30, 2018 at 3:44 PM, MrMagoo2018 wrote: > Hello folks, imagine I have the code below and I am getting the "error" > message when attempting to print() the output of 'sw_report'. > Can you suggest which method I should use to retrieve this? Is that a > dictionary maybe? > > from arist

Re: Simple question

2014-08-23 Thread Chris Angelico
On Sun, Aug 24, 2014 at 3:55 PM, John Ladasky wrote: > Shush! That's one of Python's most closely-guarded secrets! Every > politician on Earth will want to learn to program in Python after seeing that! > Not really, the legal profession has known about this for centuries. (Princess Zara, pres

Re: Simple question

2014-08-23 Thread John Ladasky
On Saturday, August 23, 2014 6:10:29 AM UTC-7, explode...@gmail.com wrote: > Can some one explain why this happens: > > True, False = False, True > > print True, False > > False True Shush! That's one of Python's most closely-guarded secrets! Every politician on Earth will want to learn to p

Re: Simple question

2014-08-23 Thread ElChino
wrote: Can some one explain why this happens: True, False = False, True print True, False False True I assume the value of True and False can be falsified. Like the 'None' object can be. So swapping their values and printing them is similar to: a = 0 b = 1 a, b = b, a print a, b Except t

Re: Simple question

2014-08-23 Thread Peter Otten
explodeandr...@gmail.com wrote: > Can some one explain why this happens: > True, False = False, True > print True, False > False True You are using Python 2 where True/False are names that can be rebound. This is for backwards compatibility as Python didn't always have booleans and people made

Re: Simple question

2014-08-23 Thread Chris Angelico
On Sat, Aug 23, 2014 at 11:10 PM, wrote: > Can some one explain why this happens: > True, False = False, True > print True, False > False True Well, the first line changes the meanings of the names "True" and "False", but doesn't change the things they point to. Those things describe themselves

Re: Simple question

2014-04-15 Thread Chris Angelico
On Wed, Apr 16, 2014 at 1:19 PM, Kushal Kumaran wrote: >>Understandable. I currently am using two consoles (laptop at my right >>hand, desktop in front of me), and every now and then I want to copy >>and paste across them :) I mean, shared clipboard works just fine >>across all my VM guests (and a

Re: Simple question

2014-04-15 Thread Kushal Kumaran
On April 16, 2014 12:37:53 AM GMT+05:30, Chris Angelico wrote: >On Wed, Apr 16, 2014 at 5:02 AM, Phil Dobbin >wrote: >> On 15/04/2014 19:41, Chris Angelico wrote: >> >>> Recommendation: If you don't understand something, keep it there :) >>> You can just copy and paste from the Python interact

Re: Simple question

2014-04-15 Thread Chris Angelico
On Wed, Apr 16, 2014 at 5:02 AM, Phil Dobbin wrote: > On 15/04/2014 19:41, Chris Angelico wrote: > >> Recommendation: If you don't understand something, keep it there :) >> You can just copy and paste from the Python interactive interpreter >> (command line or IDLE) straight into the email; it'll

Re: Simple question

2014-04-15 Thread Phil Dobbin
On 15/04/2014 20:07, Chris Angelico wrote: > On Wed, Apr 16, 2014 at 5:02 AM, Phil Dobbin wrote: >> On 15/04/2014 19:41, Chris Angelico wrote: >> >>> Recommendation: If you don't understand something, keep it there :) >>> You can just copy and paste from the Python interactive interpreter >>> (co

Re: Simple question

2014-04-15 Thread Phil Dobbin
On 15/04/2014 19:41, Chris Angelico wrote: > On Wed, Apr 16, 2014 at 4:31 AM, Phil Dobbin wrote: >> I saw the 'e-17' appended to the end but was unsure of its meaning ( >> quite a number of things are introduced in the book with clarification >> of their meaning not forthcoming 'til later on). >

Re: Simple question

2014-04-15 Thread Chris Angelico
On Wed, Apr 16, 2014 at 4:31 AM, Phil Dobbin wrote: > I saw the 'e-17' appended to the end but was unsure of its meaning ( > quite a number of things are introduced in the book with clarification > of their meaning not forthcoming 'til later on). Recommendation: If you don't understand something,

Re: Simple question

2014-04-15 Thread Phil Dobbin
On 15/04/2014 19:30, Robert Kern wrote: > On 2014-04-15 19:18, Phil Dobbin wrote: >> Hi, all. >> >> I've just started to learn Python (I'm reading Mark Lutz's 'Learning >> Python' from O'Reilly) & I'm confused as to this part: >> >> '>>> 0.1 + 0.1 + 0.1 - 0.3 >> 5.55111.' >> >> Using 'import D

Re: Simple question

2014-04-15 Thread Tim Chase
On 2014-04-15 19:18, Phil Dobbin wrote: > I'm confused as to this part: > > '>>> 0.1 + 0.1 + 0.1 - 0.3 > 5.55111.' > > What I'm wondering is why the first calculation that arrives at > '5.55111...' is so far out? You omit one key detail in your "", the "e-17" which means that is 5.55111

Re: Simple question

2014-04-15 Thread Phil Dobbin
On 15/04/2014 19:25, Zachary Ware wrote: > On Tue, Apr 15, 2014 at 1:18 PM, Phil Dobbin wrote: >> Hi, all. >> >> I've just started to learn Python (I'm reading Mark Lutz's 'Learning >> Python' from O'Reilly) & I'm confused as to this part: >> >> '>>> 0.1 + 0.1 + 0.1 - 0.3 >> 5.55111.' >> >> U

Re: Simple question

2014-04-15 Thread Robert Kern
On 2014-04-15 19:18, Phil Dobbin wrote: Hi, all. I've just started to learn Python (I'm reading Mark Lutz's 'Learning Python' from O'Reilly) & I'm confused as to this part: '>>> 0.1 + 0.1 + 0.1 - 0.3 5.55111.' Using 'import Decimal' you can get a much closer result i.e. 'Decimal('0.0')' W

Re: Simple question

2014-04-15 Thread Joel Goldstick
On Apr 15, 2014 2:19 PM, "Phil Dobbin" wrote: > > Hi, all. > > I've just started to learn Python (I'm reading Mark Lutz's 'Learning > Python' from O'Reilly) & I'm confused as to this part: > > '>>> 0.1 + 0.1 + 0.1 - 0.3 > 5.55111.' > It's not. Look at the end of the result. It's scientific not

Re: Simple question

2014-04-15 Thread Chris Angelico
On Wed, Apr 16, 2014 at 4:18 AM, Phil Dobbin wrote: > '>>> 0.1 + 0.1 + 0.1 - 0.3 > 5.55111.' > > What I'm wondering is why the first calculation that arrives at > '5.55111...' is so far out? There's something you're not seeing here. In full, the output I see is: >>> 0.1 + 0.1 + 0.1 - 0.3 5.5

Re: Simple question

2014-04-15 Thread Zachary Ware
On Tue, Apr 15, 2014 at 1:18 PM, Phil Dobbin wrote: > Hi, all. > > I've just started to learn Python (I'm reading Mark Lutz's 'Learning > Python' from O'Reilly) & I'm confused as to this part: > > '>>> 0.1 + 0.1 + 0.1 - 0.3 > 5.55111.' > > Using 'import Decimal' you can get a much closer resul

Re: Simple % question

2014-02-11 Thread Scott W Dunning
On Feb 11, 2014, at 6:36 PM, Chris Angelico wrote: > > The real question is: What do you expect that symbol to mean? > > Its actual meaning is quite simple. In long division, dividing one > number by another looks like this: Yeah I understand what the % means. It just confused me that 1%10 was

Re: Simple % question

2014-02-11 Thread Chris Angelico
On Wed, Feb 12, 2014 at 2:30 PM, Scott W Dunning wrote: > On Feb 11, 2014, at 6:36 PM, Chris Angelico wrote: >> >> The real question is: What do you expect that symbol to mean? >> >> Its actual meaning is quite simple. In long division, dividing one >> number by another looks like this: > > Yeah

Re: Simple % question

2014-02-11 Thread Scott W Dunning
On Feb 11, 2014, at 6:51 PM, Christopher Welborn wrote: > I think because 1 is evenly divisible by 10 exactly 0 times with a 1 > remainder. I mean int(1 / 10) == 0, with a 1 remainder. > The same is true for all numbers leading up to 10. > Actually I think I get it now. I think I was not really

Re: Simple % question

2014-02-11 Thread Rustom Mody
On Wednesday, February 12, 2014 6:36:17 AM UTC+5:30, Scott W Dunning wrote: > I just have a simple question. I don't understand why 1%10 = 1? This is not really about python. See http://en.wikipedia.org/wiki/Euclidean_division Particularly the examples section and note that when you divide a by

Re: Simple % question

2014-02-11 Thread Christopher Welborn
On 02/11/2014 07:06 PM, Scott W Dunning wrote: I just have a simple question. I don’t understand why 1%10 = 1? I think because 1 is evenly divisible by 10 exactly 0 times with a 1 remainder. I mean int(1 / 10) == 0, with a 1 remainder. The same is true for all numbers leading up to 10. for

Re: Simple % question

2014-02-11 Thread Chris Angelico
On Wed, Feb 12, 2014 at 12:06 PM, Scott W Dunning wrote: > I just have a simple question. I don’t understand why 1%10 = 1? The real question is: What do you expect that symbol to mean? Its actual meaning is quite simple. In long division, dividing one number by another looks like this:

Re: Simple % question

2014-02-11 Thread Ben Finney
Scott W Dunning writes: > I just have a simple question. I don’t understand why 1%10 = 1? Have you read the documentation for that operator? http://docs.python.org/3/reference/expressions.html#binary-arithmetic-operations> The language reference http://docs.python.org/3/reference/> is the pla

Re: Simple Question regarding running .py program

2012-11-22 Thread Duncan Booth
Grant Edwards wrote: > [1] OK, so I'm am annoyed with them after my Google phone updated to > Android 4.2 this afternoon and the lock-screen clock is now > _physically_painful_ to look at. However, I'm convinced that's > not evil -- just a complete and utter lack of visual design >

Re: Simple Question regarding running .py program

2012-11-15 Thread Chris Angelico
On Fri, Nov 16, 2012 at 5:37 PM, Chris Angelico wrote: > Spam filtering is nothing unique. > (Don't get me wrong though, that doesn't stop it from being a good thing. It's just not a reason to use GG above all else.) ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Question regarding running .py program

2012-11-15 Thread Chris Angelico
On Fri, Nov 16, 2012 at 3:10 PM, rusi wrote: > One small addition: GG allows spam posts to be marked as spam. > > This feature costs a few seconds and can help everyone (if a few more > GG users would use it) And Gmail lets you do the exact same thing, but I almost never need to do it, because th

Re: Simple Question regarding running .py program

2012-11-15 Thread rusi
On Nov 16, 2:29 am, ru...@yahoo.com wrote: > But of course, our genius doesn't keep any records > and the cases where he is wrong don't make as much > impression on his memory.  Further, he doesn't bother > to check the headers on the non-crap posts.  Even a > junior-high science student could see

Re: Simple Question regarding running .py program

2012-11-15 Thread Grant Edwards
On 2012-11-15, Mark Lawrence wrote: > On 15/11/2012 21:29, ru...@yahoo.com wrote: > > All I'll say is that when I read something on gmane via Thunderbird on > Windows Vista on any of the 25 Python mailing lists that I subscribe to, > I don't want to read the double spaced crap that comes from G$

Re: Simple Question regarding running .py program

2012-11-15 Thread Mark Lawrence
On 15/11/2012 21:29, ru...@yahoo.com wrote: All I'll say is that when I read something on gmane via Thunderbird on Windows Vista on any of the 25 Python mailing lists that I subscribe to, I don't want to read the double spaced crap that comes from G$. I hence perceive a problem. 1) G$ are to

Re: Simple Question regarding running .py program

2012-11-15 Thread rurpy
On 11/14/2012 04:07 PM, Steven D'Aprano wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: I'll skip the issues already addressed by Joshua Landau. >[...] > I don't understand why you suggest counting setup time for the > alternatives to Google Groups, but *don't* consider setup time for

Re: Simple Question regarding running .py program

2012-11-14 Thread Terry Reedy
On 11/14/2012 2:02 AM, ru...@yahoo.com wrote: On the other hand finding and configuring a newsreader for someone whose never done it before, as you recommend, is a major time consumer. Use a mail/news program such as Thunderbird and the newsreader comes for free. Setting up a gmane account wi

Re: Simple Question regarding running .py program

2012-11-14 Thread Terry Reedy
On 11/13/2012 11:10 PM, Chris Angelico wrote: On Wed, Nov 14, 2012 at 2:31 PM, Caroline Hou wrote: Thank you Dave and everybody here for your helpful comments!This place is awesome! I found this group when I googled python-list. Seems like this is not the usual way you guys access the list?

Re: Simple Question regarding running .py program

2012-11-14 Thread Steven D'Aprano
On Wed, 14 Nov 2012 23:07:53 +, Steven D'Aprano wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: [...] > [...] >> As an aside, I've noticed that some those most vocal against GG have >> also been very vocal about this group being inclusive. > > I call bullshit. If you are going to ac

Re: Simple Question regarding running .py program

2012-11-14 Thread Joshua Landau
Steven, whilst I hold you in high regard, this post seems spurned by bias. I would urge you to reconsider your *argument*, although your *position* has merit. On 14 November 2012 23:07, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wro

Re: Simple Question regarding running .py program

2012-11-14 Thread rurpy
On Wednesday, November 14, 2012 4:07:53 PM UTC-7, Steven D'Aprano wrote: > On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: > [...] > > As an aside, I've noticed that some those most vocal against GG have > > also been very vocal about this group being inclusive. > > I call bullshit. If you are go

Re: Simple Question regarding running .py program

2012-11-14 Thread Steven D'Aprano
On Wed, 14 Nov 2012 10:20:13 -0800, rurpy wrote: > On 11/14/2012 06:35 AM, Chris Angelico wrote: [...] >> I stand by what I said. Members, plural, of this list. I didn't say >> "all members of", ergo the word "some" is superfluous, yet not needful, >> as Princess Ida put it. > > Then you would ha

Re: Simple Question regarding running .py program

2012-11-14 Thread rurpy
On 11/14/2012 06:35 AM, Chris Angelico wrote: > On Wed, Nov 14, 2012 at 6:02 PM, rurpy wrote: >> On 11/13/2012 11:02 PM, Chris Angelico wrote: >>> To be more accurate: This is deprecated *by members of* this list. As >>> there is no commanding/controlling entity here, it's up to each >>> individual

Re: Simple Question regarding running .py program

2012-11-14 Thread Chris Angelico
On Wed, Nov 14, 2012 at 6:02 PM, wrote: > On 11/13/2012 11:02 PM, Chris Angelico wrote: >> To be more accurate: This is deprecated *by members of* this list. As >> there is no commanding/controlling entity here, it's up to each >> individual to make a decision - for instance, abusive users get >>

Re: Simple Question regarding running .py program

2012-11-13 Thread rusi
On Nov 14, 12:02 pm, ru...@yahoo.com wrote: > > == > [*] Actually, now that I think about it, IIRC one can sign > up for python-list email, and go into the mailman settings > and disable mail delivery, allowing one to post to the list > via email yet read the list via GG, Gmane or whatever. > Howev

Re: Simple Question regarding running .py program

2012-11-13 Thread rurpy
On 11/13/2012 11:02 PM, Chris Angelico wrote: > On Wed, Nov 14, 2012 at 4:08 PM, rurpy wrote: >> On 11/13/2012 09:10 PM, Chris Angelico wrote: >>> * Use a news-to-web gateway such as Google Groups. That >>> specific one is deprecated on this list, as there's more >>> noise than signal from Google G

Re: Simple Question regarding running .py program

2012-11-13 Thread Chris Angelico
On Wed, Nov 14, 2012 at 4:08 PM, wrote: > On 11/13/2012 09:10 PM, Chris Angelico wrote: >> * Use a news-to-web gateway such as Google Groups. That >> specific one is deprecated on this list, as there's more >> noise than signal from Google Groups. > > Caroline, Chris is mistaken about this, if fo

Re: Simple Question regarding running .py program

2012-11-13 Thread rurpy
On 11/13/2012 09:10 PM, Chris Angelico wrote: > On Wed, Nov 14, 2012 at 2:31 PM, Caroline Hou wrote: >> Thank you Dave and everybody here for your helpful comments!This >> place is awesome! I found this group when I googled python-list. >> Seems like this is not the usual way you guys access the li

Re: Simple Question regarding running .py program

2012-11-13 Thread Chris Angelico
On Wed, Nov 14, 2012 at 2:31 PM, Caroline Hou wrote: > Thank you Dave and everybody here for your helpful comments!This place is > awesome! I found this group when I googled python-list. Seems like this is > not the usual way you guys access the list? There are several ways to communicate with

Re: Simple Question regarding running .py program

2012-11-13 Thread Caroline Hou
On Tuesday, November 13, 2012 7:35:32 AM UTC-5, Ramchandra Apte wrote: > On Tuesday, 13 November 2012 08:15:45 UTC+5:30, Caroline Hou wrote: > > > On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel wrote: > > > > > > > On 11/12/2012 09:02 PM, Caroline Hou wrote: > > > > > > > > > >

Re: Simple Question regarding running .py program

2012-11-13 Thread Ramchandra Apte
On Tuesday, 13 November 2012 08:15:45 UTC+5:30, Caroline Hou wrote: > On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel wrote: > > > On 11/12/2012 09:02 PM, Caroline Hou wrote: > > > > > > > Hi all! > > > > > > > > > > > > > > I just started learning Python by myself and I have an

Re: Simple Question regarding running .py program

2012-11-13 Thread Dave Angel
On 11/12/2012 09:45 PM, Caroline Hou wrote: > > Hi Dave! > > thank you very much for your quick reply! I did manage to get the program run > from cmd.exe. > So does it mean that if I want to use python interactively,I should use the > interpreter,while if I just want to run a python program,

Re: Simple Question regarding running .py program

2012-11-12 Thread Terry Reedy
On 11/12/2012 9:45 PM, Caroline Hou wrote: Also, how could I edit my script? I have sth called "IDLE" installed along with python. Is it the right place to write/edit my script? IDLE is one way to edit; I use it. When you want to run, hit F5 and stdout and stderr output goes to the shell wind

Re: Simple Question regarding running .py program

2012-11-12 Thread Caroline Hou
On Monday, 12 November 2012 21:25:08 UTC-5, Dave Angel wrote: > On 11/12/2012 09:02 PM, Caroline Hou wrote: > > > Hi all! > > > > > > I just started learning Python by myself and I have an extremely simple > > question now! > > > I am in my Python interpreter now and I want to open/edit a pro

Re: Simple Question regarding running .py program

2012-11-12 Thread Dave Angel
On 11/12/2012 09:02 PM, Caroline Hou wrote: > Hi all! > > I just started learning Python by myself and I have an extremely simple > question now! > I am in my Python interpreter now and I want to open/edit a program called > nobel.py. But when I typed >>> python nobel.py, it gave me a > "SyntaxE

Re: Simple question about Queue.Queue and threads

2010-02-08 Thread Frank Millman
On Feb 8, 4:51 pm, Steven wrote: Queue objects have support for this signaling baked in with q.task_done and q.join. After the server process has put all tasks into the queue, it can join the queue itself, not the worker threads. q.join() This will block until all tasks have been gotten AND

Re: Simple question about Queue.Queue and threads

2010-02-08 Thread Steven
On Feb 5, 7:45 am, "Frank Millman" wrote: > Hi all > > Assume you have a server process running, a pool of worker threads to > perform tasks, and aQueue.Queue() to pass the tasks to the workers. > > In order to shut down the server cleanly, you want to ensure that the > workers have all finished t

Re: Simple question about Queue.Queue and threads

2010-02-05 Thread Frank Millman
On Feb 6, 7:59 am, "Gabriel Genellina" wrote: En Fri, 05 Feb 2010 09:45:30 -0300, Frank Millman escribió: [...] > However, the queue is not empty - it still has the final None in it. Yes - but who cares? :) That was my point. I didn't think I needed to care, but I wanted to be sure I w

Re: Simple question about Queue.Queue and threads

2010-02-05 Thread Gabriel Genellina
En Fri, 05 Feb 2010 09:45:30 -0300, Frank Millman escribió: Assume you have a server process running, a pool of worker threads to perform tasks, and a Queue.Queue() to pass the tasks to the workers. In order to shut down the server cleanly, you want to ensure that the workers have all fi

Re: simple question about Dictionary type containing List objects

2009-07-13 Thread Ulrich Eckhardt
gganesh wrote: > I have a dict object like > emails={'mycontacts': [ 'x...@gmail.com, 'y...@gmail.com', > 'z...@gmail.com'], 'myname':['gganesh']} > I need to get the lenght of the list mycontacts ,like > mycontacts_numbers=3 mycontacts = emails['mycontacts'] mycontacts_number = len(mycontacts) A

Re: simple question about Dictionary type containing List objects

2009-07-13 Thread Xavier Ho
On Mon, Jul 13, 2009 at 6:34 PM, gganesh wrote: > Hi group, > I have a dict object like > emails={'mycontacts': [ 'x...@gmail.com, 'y...@gmail.com', > 'z...@gmail.com'], 'myname':['gganesh']} > I need to get the lenght of the list mycontacts ,like > mycontacts_numbers=3

Re: Simple question about accessing instance properties.

2009-05-21 Thread Lacrima
On May 21, 7:04 pm, MRAB wrote: > Lacrima wrote: > > Hello! > > > I think I have a very simple question, but I can't understand how to > > access object properties in a way described below. > > For example I have an instance of any class: > > class Person: > >    def __init__(self): > >      

Re: Simple question about accessing instance properties.

2009-05-21 Thread MRAB
Lacrima wrote: Hello! I think I have a very simple question, but I can't understand how to access object properties in a way described below. For example I have an instance of any class: class Person: def __init__(self): self.name = 'John' self.email =

Re: simple question re list iteration semantics

2009-04-21 Thread Esmail
Paul Rubin wrote: Esmail writes: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i Not the same--after the exit of the first loop, 'i' is the length of the list. After the exit of the second loop, 'i' is the last element. Yes, agree

Re: simple question re list iteration semantics

2009-04-21 Thread Paul Rubin
Esmail writes: > for i in range(0, len(li)): > print li[i] > > Will this always be equivalent to > > > for i in li: > print i Not the same--after the exit of the first loop, 'i' is the length of the list. After the exit of the second loop, 'i' is the last element. > Would the 2nd o

Re: simple question re list iteration semantics

2009-04-21 Thread Esmail
Thanks everyone, as usual, very informative posts! Esmail -- http://mail.python.org/mailman/listinfo/python-list

Re: simple question re list iteration semantics

2009-04-21 Thread Dave Angel
Esmail wrote: Hello all, I have a simple question regarding semantics. Given a list 'li', I can always do this to iterate through all items in order: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i I assume it is, and the order will al

Re: simple question re list iteration semantics

2009-04-21 Thread Steven D'Aprano
On Tue, 21 Apr 2009 21:06:46 -0400, Esmail wrote: > Given a list 'li', I can always do this to iterate through all items in > order: > > for i in range(0, len(li)): > print li[i] > > Will this always be equivalent to > > for i in li: > print i For lists, yes, that will always be equ

Re: simple question re list iteration semantics

2009-04-21 Thread MRAB
Esmail wrote: Hello all, I have a simple question regarding semantics. Given a list 'li', I can always do this to iterate through all items in order: for i in range(0, len(li)): print li[i] Will this always be equivalent to for i in li: print i I assume it is, and the order will al

Re: Simple question about yyyy/mm/dd

2009-03-19 Thread Scott David Daniels
mattia wrote: Hi all, I need to receive in input a date represented by a string in the form "/mm/dd" (or reversed), then I need to assure that the date is = the current date and then split the dates in variables like year, month, day. Is there some module to do this quickly? Look into tim

Re: Simple question about yyyy/mm/dd

2009-03-19 Thread skip
>> Hi all, I need to receive in input a date represented by a string in >> the form "/mm/dd" (or reversed), then I need to assure that the >> date is = the current date and then split the dates in variables like >> year, month, day. Is there some module to do this quickly? The

Re: Simple question - stock market simulation

2009-02-10 Thread Hendrik van Rooyen
"cptn.spoon" wrote: On Feb 9, 6:48 pm, "Hendrik van Rooyen" wrote: >> No. >> At this level, just use a list of instances of your Stock class. >> >> - Hendrik > >How do I get a list of instances of a particular class? Is there a way >to do this dynamically? Yes there is. First make an empty list

Re: Simple question - stock market simulation

2009-02-09 Thread cptn.spoon
On Feb 10, 10:26 am, Robert Kern wrote: > On 2009-02-09 17:10, cptn.spoon wrote: > > > > > On Feb 9, 6:48 pm, "Hendrik van Rooyen"  wrote: > >> "cptn.spoon"  wrote: > > >> On Feb 9, 3:58 pm, Paul Rubin  wrote: > > >>> Thanks Paul! I thought this might be the case. So

Re: Simple question - stock market simulation

2009-02-09 Thread Robert Kern
On 2009-02-09 17:10, cptn.spoon wrote: On Feb 9, 6:48 pm, "Hendrik van Rooyen" wrote: "cptn.spoon" wrote: On Feb 9, 3:58 pm, Paul Rubin wrote: Thanks Paul! I thought this might be the case. So how would I get the StockMarket class instance to contain many Stoc

Re: Simple question - stock market simulation

2009-02-09 Thread cptn.spoon
On Feb 9, 6:48 pm, "Hendrik van Rooyen" wrote: > "cptn.spoon" wrote: > > On Feb 9, 3:58 pm, Paul Rubin wrote: > > >Thanks Paul! I thought this might be the case. So how would I get the > >StockMarket class instance to contain many Stock class instances and > >then b

Re: Simple question - stock market simulation

2009-02-09 Thread cptn.spoon
On Feb 10, 3:29 am, Anthra Norell wrote: > cptn.spoon wrote: > > I'm trying to create an incredibly simple stock market simulator to be > > used in a childrens classroom and I'm wondering whether someone can > > point me in the right direction. > > > I basically want to be able to have a stock str

Re: Simple question - stock market simulation

2009-02-09 Thread Anthra Norell
cptn.spoon wrote: I'm trying to create an incredibly simple stock market simulator to be used in a childrens classroom and I'm wondering whether someone can point me in the right direction. I basically want to be able to have a stock struct as follows: StockName = "Test" StockPriceList = (12,13

Re: Simple question - stock market simulation

2009-02-09 Thread Hendrik van Rooyen
"cptn.spoon" wrote: On Feb 9, 3:58 pm, Paul Rubin wrote: >Thanks Paul! I thought this might be the case. So how would I get the >StockMarket class instance to contain many Stock class instances and >then be able to iterate through them? I'm guessing the basic struc

Re: Simple question - stock market simulation

2009-02-08 Thread Terry Reedy
cptn.spoon wrote: On Feb 9, 3:58 pm, Paul Rubin wrote: "cptn.spoon" writes: I'm not asking for tips on the program itself, I just can't figure out how to get the data structures in place. Would I use Classes or would I use dictionaries? Am I completely off the ma

Re: Simple question - stock market simulation

2009-02-08 Thread Paul Rubin
"cptn.spoon" writes: > def __init__(self, stockname, stockpricelist[], stockrisk, > stockqty): ... You would say just stockpricelist rather than stockpricelist[], but other than that your class def looks good. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple question - stock market simulation

2009-02-08 Thread cptn.spoon
On Feb 9, 3:58 pm, Paul Rubin wrote: > "cptn.spoon" writes: > > I'm not asking for tips on the program itself, I just can't figure out > > how to get the data structures in place. Would I use Classes or would > > I use dictionaries? Am I completely off the mark with

Re: Simple question - stock market simulation

2009-02-08 Thread Paul Rubin
"cptn.spoon" writes: > I'm not asking for tips on the program itself, I just can't figure out > how to get the data structures in place. Would I use Classes or would > I use dictionaries? Am I completely off the mark with this? Typically you would use a class for the multi-fielded data structure;

Re: Simple question about Python lists

2008-11-17 Thread Eric
On Nov 11, 7:31 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > On Wed, 12 Nov 2008 10:08:45 +1100, Ben Finney wrote: > > > >Eric<[EMAIL PROTECTED]> writes: > > >> In MATLAB, if  I just want the first, fifth  and eighth element I > > >> might do something

Re: Simple question about Python lists

2008-11-12 Thread Scott David Daniels
Eric wrote: ... In MATLAB, if I just want the first, fifth and eighth element I might do something like this: b = a([1 5 8]); On Nov 11, 1:51 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> replied: b = [a[i] for i in [1, 5, 8]] To which Eric said: Thanks! It makes sense, but in this cas

Re: Simple question about Python lists

2008-11-11 Thread Ben Finney
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Wed, 12 Nov 2008 10:08:45 +1100, Ben Finney wrote: > > > Eric <[EMAIL PROTECTED]> writes: > >> In MATLAB, if I just want the first, fifth and eighth element I > >> might do something like this: > >> > >> b = a([1 5 8]); > > > > Yes: the above c

  1   2   3   >