Re: back with more issues

2013-08-11 Thread Kris Mesenbrink
darn i was hoping i could put off learning classes for a bit, but it seems that is not the case. i have tested it a bit and it seems to be working correctly now. import random class player(): hp = 10 speed = 5 attack = random.randint(0,5) print (player.

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Gregory Ewing
Michael Torrie wrote: I've always wondered if the 160 character limit or whatever it is is a hard limit in their system, or if it's just a variable they could tweak if they felt like it. Isn't it for compatibility with SMS? Twitter could probably change it, but persuading all the cell phone net

Re: back with more issues

2013-08-11 Thread Dave Angel
Kris Mesenbrink wrote: > import random > > def player(): > hp = 10 > speed = 5 > attack = random.randint(0,5) > The net resut of this function is nothing. It assigns values, then they're lost when the function returns. A function is the wrong way to deal with these three names. > de

Re: back with more issues

2013-08-11 Thread Joel Goldstick
On Mon, Aug 12, 2013 at 12:35 AM, Kris Mesenbrink wrote: > the idea was to store variables for later use, but you are correct i don't > understand functions or if that is even the best way to do it. i guess i'd > want to be able to call the HP and ATTACK variables of player for when the > battl

Re: Introduction to my fellow Python Friends

2013-08-11 Thread Cameron Simpson
On 11Aug2013 13:47, Krishnan Shankar wrote: | 1. How to acknowledge a reply? Should i put a one to one mail or send it to | the mailing list itself? Generally, a personal acknowledgement email is not necessary; usually one would reply to the list; by citing the previous message author (as I have

Re: back with more issues

2013-08-11 Thread Kris Mesenbrink
the idea was to store variables for later use, but you are correct i don't understand functions or if that is even the best way to do it. i guess i'd want to be able to call the HP and ATTACK variables of player for when the battle gets called. i would then use the variables in battle to figure

Re: Is it possible to make a unittest decorator to rename a method from "x" to "testx?"

2013-08-11 Thread adam . preble
On Friday, August 9, 2013 1:31:43 AM UTC-5, Peter Otten wrote: > I see I have to fix it myself then... Sorry man, I think in my excitement of seeing the first of your examples to work, that I missed the second example, only seeing your comments about it at the end of the post. I didn't expect s

Re: Resolving import errors reported by PyLint in modules using Python.NET

2013-08-11 Thread adam . preble
I thought I responded to this. Oh well On Friday, August 9, 2013 12:47:43 AM UTC-5, Benjamin Kaplan wrote: > Are you using Python.NET or IronPython? IronPython is reasonably well > > supported, and it looks like there's a patch you can use to get PyLint > > working on it (see > > http://mail.

Re: back with more issues

2013-08-11 Thread Joel Goldstick
On Sun, Aug 11, 2013 at 11:33 PM, Kris Mesenbrink wrote: > import random > > def player(): > hp = 10 > speed = 5 > attack = random.randint(0,5) # add the following line to return attack value: return attack > > def monster (): > hp = 10 > speed = 4 > > def battle

back with more issues

2013-08-11 Thread Kris Mesenbrink
import random def player(): hp = 10 speed = 5 attack = random.randint(0,5) def monster (): hp = 10 speed = 4 def battle(player): print ("a wild mosnter appered!") print ("would you like to battle?") answer = input() if answer == ("yes"): return player(

RE: connection change

2013-08-11 Thread Inna Belakhova
Hi, I don't know much about Python code. Where is the connection made, eg config file - where can I find it? Our SQLITe database is currently 9GB and we have a table that contains 7GB of BLOB type. I think the table cannot handle any more insert of BLOB hence I want to change it to SQL database -

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Michael Torrie
On 08/11/2013 09:34 AM, MRAB wrote: > If twitter counts characters, not codepoints, you could then ask > whether it passes the codepoints through as given. If it does, then you > experiment to see how much data you could send encoded as a sequence of > combining codepoints. (You might want to check

Re: Python Basic Doubt

2013-08-11 Thread Steven D'Aprano
On Sun, 11 Aug 2013 18:58:25 +0200, Xavi wrote: > Respect to the "Names starting and ending with double-underscore". I > don't know how to get the name of a classe without them. > obj.__class__.__name__ I didn't say you should *never* use them, but most of the time, you don't. However type(obj).

Re: Python Basic Doubt

2013-08-11 Thread Xavi
Thanks to all for your answers, I guess it is more flexible with isinstance (the duck test :) I'm going to change the type checks. Respect to the "Names starting and ending with double-underscore". I don't know how to get the name of a classe without them. obj.__class__.__name__ Thanks. -- Xavi

Re: Elegant compare

2013-08-11 Thread Jason Friedman
> This is a hard question to answer, because your code snippet isn't > clearly extensible to the case where you have ten attributes. What's the > rule for combining them? If instance A has five attributes less than > those of instance B, and five attributes greater than those of instance > B, which

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread duncan smith
On 11/08/13 15:02, Roy Smith wrote: In article , Skip Montanaro wrote: See the Rationale of PEP 450 for more reasons why “install NumPy� is not a feasible solution for many use cases, and why having ‘statistics’ as a pure-Python, standard-library package is desirable. I read that b

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread MRAB
On 11/08/2013 10:54, Joshua Landau wrote: On 11 August 2013 07:24, Chris Angelico wrote: On Sun, Aug 11, 2013 at 7:17 AM, Joshua Landau wrote: Given tweet = b"caf\x65\xCC\x81".decode(): >>> tweet 'café' But: >>> len(tweet) 5 You're now looking at the difference between gl

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread Roy Smith
In article , Skip Montanaro wrote: > > See the Rationale of PEP 450 for more reasons why “install NumPy” is not > > a feasible solution for many use cases, and why having ‘statistics’ as a > > pure-Python, standard-library package is desirable. > > I read that before posting but am not

Re: Introduction to my fellow Python Friends

2013-08-11 Thread Dave Angel
Krishnan Shankar wrote: > Hi Friends, Hi, and welcome to the mailing list. > I figured out that the best way is to talk to the experts and so i > subscribed to this mailing list. It will be cool if anybody can help me out > by telling the etiquette of this mailing list, like > > 1. How to

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread Steven D'Aprano
On Sun, 11 Aug 2013 06:50:36 -0500, Skip Montanaro wrote: >> See the Rationale of PEP 450 for more reasons why “install NumPy” is >> not a feasible solution for many use cases, and why having ‘statistics’ >> as a pure-Python, standard-library package is desirable. > > I read that before posting b

Re: Am I not seeing the Error?

2013-08-11 Thread Roy Smith
In article <52074b43$0$3$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 11 Aug 2013 03:33:52 +0100, Chris Angelico wrote: > > > Next thing to do is split it into more lines. Why is all that in a > > single line? > > The only good excuse for writing multiple statement

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 13:51, wrote: > Le dimanche 11 août 2013 11:09:44 UTC+2, Steven D'Aprano a écrit : >> On Sun, 11 Aug 2013 07:17:42 +0100, Joshua Landau wrote: >> >> The reason some accented letters have single code point forms is to >> support legacy charsets; ... > > No. > > jmf > > PS Unicode

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread wxjmfauth
Le dimanche 11 août 2013 11:09:44 UTC+2, Steven D'Aprano a écrit : > On Sun, 11 Aug 2013 07:17:42 +0100, Joshua Landau wrote: > > > > > The reason some accented letters have single code point forms is to > > support legacy charsets; ... No. jmf PS Unicode normalization is failing expectedl

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread Nicholas Cole
On Sun, Aug 11, 2013 at 12:50 PM, Skip Montanaro wrote: > > See the Rationale of PEP 450 for more reasons why “install NumPy” is not > > a feasible solution for many use cases, and why having ‘statistics’ as a > > pure-Python, standard-library package is desirable. > > I read that before posting

Reading from stdin first, then use curses

2013-08-11 Thread Timo Schmiade
Hi all, I wrote a replacement for urlview to properly extract URLs from emails. You can find the first draft here: https://github.com/the-isz/pyurlview When I call it with an email file passed to the '-f' argument, it does pretty much what I want already. However, I intend to use it in mutt, w

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 12:14, Steven D'Aprano wrote: > On Sun, 11 Aug 2013 10:44:40 +0100, Joshua Landau wrote: > >> On 11 August 2013 10:09, Steven D'Aprano >> wrote: >>> The reason some accented letters have single code point forms is to >>> support legacy charsets; the reason some only exist as com

Re: PEP 450 Adding a statistics module to Python

2013-08-11 Thread Skip Montanaro
> See the Rationale of PEP 450 for more reasons why “install NumPy” is not > a feasible solution for many use cases, and why having ‘statistics’ as a > pure-Python, standard-library package is desirable. I read that before posting but am not sure I agree. I don't see the screaming need for this pa

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Chris Angelico
On Sun, Aug 11, 2013 at 12:14 PM, Steven D'Aprano wrote: > Consider a single character. It can have 0 to 5 accents, in any > combination. Order doesn't matter, and there are no duplicates, so there > are: > > 0 accent: take 0 from 5 = 1 combination; > 1 accent: take 1 from 5 = 5 combinations; > 2

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Steven D'Aprano
On Sun, 11 Aug 2013 10:44:40 +0100, Joshua Landau wrote: > On 11 August 2013 10:09, Steven D'Aprano > wrote: >> The reason some accented letters have single code point forms is to >> support legacy charsets; the reason some only exist as combining >> characters is due to the combinational explosi

Re: Am I not seeing the Error?

2013-08-11 Thread Joshua Landau
On 11 August 2013 09:28, Steven D'Aprano wrote: > into more lines. Why is all that in a >> single line? > > The only good excuse for writing multiple statements on a single line > separated by semi-colons is if the Enter key on your keyboard is broken. That's not a good excuse. It *is* a good ex

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread Joshua Landau
On 11 August 2013 09:57, Chris Angelico wrote: > On Thu, Aug 8, 2013 at 8:20 AM, sagar varule wrote: >> stdin, stdout, stderr = client.exec_command(bv_cmd) >> for line in stderr.readlines(): >> print line >> for line in stdout.readlines(): >>

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 07:24, Chris Angelico wrote: > On Sun, Aug 11, 2013 at 7:17 AM, Joshua Landau wrote: >> Given tweet = b"caf\x65\xCC\x81".decode(): >> >> >>> tweet >> 'café' >> >> But: >> >> >>> len(tweet) >> 5 > > You're now looking at the difference between glyphs and combining

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Joshua Landau
On 11 August 2013 10:09, Steven D'Aprano wrote: > The reason some accented letters have single code point forms is to > support legacy charsets; the reason some only exist as combining > characters is due to the combinational explosion. Some languages allow > you to add up to five or six different

Re: Introduction to my fellow Python Friends

2013-08-11 Thread Chris Angelico
On Sun, Aug 11, 2013 at 9:17 AM, Krishnan Shankar wrote: > I figured out that the best way is to talk to the experts and so i > subscribed to this mailing list. It will be cool if anybody can help me out > by telling the etiquette of this mailing list, like Hi! Welcome! > 1. How to acknowledge a

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Steven D'Aprano
On Sun, 11 Aug 2013 07:17:42 +0100, Joshua Landau wrote: > Basically, I think Twitter's broken. Oh, in about a million ways, but apparently people like it :-( > For my full discusion on the matter, see: > http://www.reddit.com/r/learnpython/comments/1k2yrn/ help_with_len_and_input_function_33/c

Introduction to my fellow Python Friends

2013-08-11 Thread Krishnan Shankar
Hi Friends, I would like to introduce myself. I am Krishnan from Chennai, India. I am using python for 2 years for Test Automation. I am fascinated by the language and its capabilities. I am willing to move into Python development and I am doing the best i can to learn the language completely and

Re: Could you verify this, Oh Great Unicode Experts of the Python-List?

2013-08-11 Thread Chris Angelico
On Sun, Aug 11, 2013 at 7:17 AM, Joshua Landau wrote: > Given tweet = b"caf\x65\xCC\x81".decode(): > > >>> tweet > 'café' > > But: > > >>> len(tweet) > 5 You're now looking at the difference between glyphs and combining characters. Twitter counts combining characters, so when you

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread Chris Angelico
On Thu, Aug 8, 2013 at 8:20 AM, sagar varule wrote: > stdin, stdout, stderr = client.exec_command(bv_cmd) > for line in stderr.readlines(): > print line > for line in stdout.readlines(): > print line > But problem here is client.exec_command

Re: Python Basic Doubt

2013-08-11 Thread Steven D'Aprano
On Sat, 10 Aug 2013 16:42:22 -0400, Roy Smith wrote: > In article , > Dennis Lee Bieber wrote: > >> Because id(n) is not giving you the address of the NAME. It is giving >> you the address of the "10" > > Actually, it is giving you the id of the int(10) object. Maybe it's an > address, maybe

Re: Am I not seeing the Error?

2013-08-11 Thread Steven D'Aprano
On Sun, 11 Aug 2013 03:33:52 +0100, Chris Angelico wrote: > Next thing to do is split it into more lines. Why is all that in a > single line? The only good excuse for writing multiple statements on a single line separated by semi-colons is if the Enter key on your keyboard is broken. :-) --

Re: Elegant compare

2013-08-11 Thread Steven D'Aprano
On Sat, 10 Aug 2013 21:41:00 -0600, Jason Friedman wrote: > class my_class: > def __init__(self, attr1, attr2): > self.attr1 = attr1 #string > self.attr2 = attr2 #string > def __lt__(self, other): > if self.attr1 < other.attr1: > return True > el

Re: Python Basic Doubt

2013-08-11 Thread Steven D'Aprano
On Sat, 10 Aug 2013 20:21:46 -0700, Gary Herron wrote: > Our knee-jerk reaction to beginners using "is" should be: > Don't do that! You almost certainly want "==". Consider "is" an > advanced topic. > > Then you can spend as much time as you want trying to coach them into an > understandi

Re: Python Basic Doubt

2013-08-11 Thread Steven D'Aprano
On Sat, 10 Aug 2013 17:42:21 -0700, Gary Herron wrote: > But for each of your examples, using "==" is equivalent to using "is". > Each of > if something == None > if device == _not passed > if device != None > would all work as expected. In none of those cases is "is" actually > ne

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread Joshua Landau
On 11 August 2013 08:02, sagar varule wrote: > On Sunday, August 11, 2013 11:28:31 AM UTC+5:30, Joshua Landau wrote: >> You also didn't say what didn't work with the first block of code. > > Submitting Command to Interactive Shell through code did not work. In what way didn't it work? What's the

Re: Paramiko Help. Execute command to Interactive Shell which is opened by SSHClient()

2013-08-11 Thread sagar varule
On Sunday, August 11, 2013 11:28:31 AM UTC+5:30, Joshua Landau wrote: > On 11 August 2013 06:18, sagar varule wrote: > > > Can any one comment on this.. > > > > If you don't get replies here it's probably because no-one knows > > Paramiko. I suggest posting elsewhere to see if there are any P