Re: How can I verify if the content of a variable is a list or a string?

2012-01-31 Thread Noah Hall
On Wed, Feb 1, 2012 at 12:44 AM, Andres Soto wrote: > Hi, > I'm writing a function which receive a list which elements are strings or > new lists (sublists) containing strings. > How can I verify if sone element of the list (which is contained in a > variable) is a list or a string? > I found the

Re: Installing Python on CentOS 6 - a big pain

2012-01-19 Thread Noah Hall
On Thu, Jan 19, 2012 at 10:47 AM, Steven D'Aprano wrote: > On Thu, 19 Jan 2012 20:43:23 +1100, Chris Angelico wrote: > >> On Thu, Jan 19, 2012 at 3:36 PM, Steven D'Aprano >> wrote: >>> With all the tools installed, it's a matter of a few minutes effort to >>> build from scratch: > > [...] >> Now,

Re: Can someone explain 2to3?

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 7:08 PM, Joshua Miller wrote: > I've looked there and it didn't worki may've made all the nesscary > changes manually anyways though i'm not sure... What about it didn't work? Have a read of this too - http://wiki.python.org/moin/PortingPythonToPy3k and if you're still

Re: Can someone explain 2to3?

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 5:06 PM, Joshua Miller wrote: > Ok i'm trying to convert https://github.com/rdeaton/spyral to python3 > but i'm at a loss on how to actually use 2to3. Can someone explain > it's proper use to me so i can do the conversion? prefereably where i > can take "C:\Python32\Lib\sit

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-14 Thread Noah Hall
On Sat, Jan 14, 2012 at 2:39 AM, Terry Reedy wrote: > On 1/13/2012 3:42 PM, Noah Hall wrote: >> >> On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazi >>  wrote: >>> >>> dear people! >>> I have just opened my MTU client, and figured out that thro

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-13 Thread Noah Hall
On Fri, Jan 13, 2012 at 8:07 PM, Tamer Higazi wrote: > dear people! > I have just opened my MTU client, and figured out that through my > comment, i caused a complete NONSENSE discussion at all. > > > 1. I am not a zealot or whatever. I code on Linux and port it on MAC and > WINDOWS. I do write so

Re: Zealotry [was Re: how to install lxml in window xp?] (OT)

2012-01-13 Thread Noah Hall
On Fri, Jan 13, 2012 at 7:54 AM, Stefan Behnel wrote: > Noah Hall, 13.01.2012 08:29: >> I'M SO COOL >> USE MY HARDCORE GENTOO INSTALL THAT TOOK 36 HOURS AND SHAVED 2 SECONDS >> OFF MY BOOTUP TIME > > Just an off-topic thing that your comment above reminded me of

Re: Zealotry [was Re: how to install lxml in window xp?]

2012-01-12 Thread Noah Hall
On Fri, Jan 13, 2012 at 5:47 AM, alex23 wrote: > On Jan 13, 3:02 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: >> Why is it that only Linux and Mac users are accused of being "zealots"? > > Incidentally, in the post I replied to, Tamer was talking about > Windows 7, so there's that

Re: Please explain this for me

2011-12-20 Thread Noah Hall
On Wed, Dec 21, 2011 at 4:39 AM, Emeka wrote: > > Hello All, > v = [] > > def add_to_list(plist): >     u = plist.append(90) >     return u > > add_to_list(v)  # This function call returns nothing > Could someone explain why this function call will return nothing? It's because add_to_list return

Re: Return of an old friend

2011-11-25 Thread Noah Hall
On Fri, Nov 25, 2011 at 5:08 AM, Matt Joiner wrote: > I haven't heard of you before, but feel like I've missed out on something. > > Do you (or someone else) care to link to some of your more contentious work? Ignore him, he's a troll with an unjustly inflated ego. -- http://mail.python.org/mail

Re: How to test if object is an integer?

2011-10-17 Thread Noah Hall
On Sat, Oct 15, 2011 at 12:44 AM, MrPink wrote: > > Is there a function in Python that can be used to test if the value in > a string is an integer?  I had to make one up for myself and it looks > like this: > > def isInt(s): >    try: >        i = int(s) >        return True >    except ValueErro

Re: 1/2 evaluates to 0

2011-10-12 Thread Noah Hall
On Wed, Oct 12, 2011 at 12:28 PM, Laurent wrote: > >> Include from __future__ import division on the top of your file >> >  from __future__ import division >  1/2 >> >> 0.5 >> > > Wohaw. This means that this behavior is going to be default in a foreseeable > future ? Never in Python 2.x,

Re: 1/2 evaluates to 0

2011-10-12 Thread Noah Hall
On Wed, Oct 12, 2011 at 11:14 AM, Laurent Claessens wrote: > This is well known : > 1/2 > 0 > > This is because the division is an "integer division". > > My question is : how can I evaluate 1/2 to 0.5 ? Is there some non integer Include from __future__ import division on the top of your fil

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Noah Hall
On Wed, Jun 29, 2011 at 9:34 PM, Andrew Berg wrote: > I didn't get at least two messages from the "call a function every 10 > seconds thread", and possibly some other messages, and I access the > group via the mailing list. I use the latest stable Thunderbird, if that > matters. I've only noticed

Re: Suppressing newline writing to file after variable

2011-06-28 Thread Noah Hall
On Tue, Jun 28, 2011 at 6:32 PM, Ellerbee, Edward wrote: > Thank you! > > That works perfect, I'll have to look into string formatting more. > > My next issue to solve I've been researching is: > > How to condense a group of numbers to a wildcard list. For example: > > 252205 > 252206 > 252208 > 2

Re: Suppressing newline writing to file after variable

2011-06-28 Thread Noah Hall
On Tue, Jun 28, 2011 at 5:05 PM, Ellerbee, Edward wrote: > Hi all, newbie question here. I'm using python 2.7. I've built my first > program to pull some info off the web, process it, and build dialpeers for a > cisco router. I have 2 problems - the first is the formatting of printing > the gather

Re: Python basic program problem

2011-06-27 Thread Noah Hall
On Mon, Jun 27, 2011 at 11:18 PM, Amaninder Singh wrote: > Yes, I think I am using 3.0 version. So how much difference is in between > these two? > On Jun 26, 2011, at 11:18 PM, Noah Hall wrote: >> On Mon, Jun 27, 2011 at 8:05 AM, Amaninder Singh >> wrote: >>> Hi,

Re: Python basic program problem

2011-06-27 Thread Noah Hall
On Mon, Jun 27, 2011 at 8:05 AM, Amaninder Singh wrote: > Hi, > I am fairly new to python, I am trying to write simple code and It is > giving me syntax error. I am reading a book and following the > directions as it says in the book but I am not sure why it is not > working. Please guide me throu

Re: Default value for optional parameters unexpected behaviour?

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 7:28 PM, Marc Aymerich wrote: > Hi, > I'm trying to define a function that has an optional parameter which > should be an empty list whenever it isn't given. However, it takes as > value the same value as the last time the function was executed. What > is the reason of this

Re: Python 3 syntax error question

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 4:28 PM, rzed wrote: > steve+comp.lang.pyt...@pearwood.info wrote in > news:4e074768$0$29982$c3e8da3$54964...@news.astraweb.com: > >> rzed wrote: >> >>> I've tried to install PySVG in a Python 3 setting, and I get a >>> few errors on the build. Most are easy to fix, but thi

Re: Python 3 syntax error question

2011-06-26 Thread Noah Hall
On Sun, Jun 26, 2011 at 2:04 PM, rzed wrote: > I've tried to install PySVG in a Python 3 setting, and I get a few > errors on the build. Most are easy to fix, but this one I can't > explain or fix: > > > Traceback (most recent call last): >  File "", line 1, in >  File "builders.py", line 12, in

Re: reg: playing with the list

2011-06-24 Thread Noah Hall
On Fri, Jun 24, 2011 at 8:01 AM, kaustubh joshi wrote: > Hey all, > I am new here and new to python too. In general new to programming . > I was working on aproblem. > and need some help. > I have a list of numbers say [2,3,5,6,10,15] > which all divide number 30. > Now i have to reduce this list

Re: Project-wide variable...

2011-06-23 Thread Noah Hall
On Thu, Jun 23, 2011 at 6:18 PM, Guillaume Martel-Genest wrote: > On Jun 23, 9:41 am, Gnarlodious wrote: >> Is there a way to declare a project-wide variable and use that in all >> downstream modules? >> > What about using an environment variable? Yes, that's fine, but only if the data is suitab

Re: Project-wide variable...

2011-06-23 Thread Noah Hall
On Thu, Jun 23, 2011 at 3:09 PM, Gnarlodious wrote: > On Jun 23, 7:59 am, Noah Hall wrote: >> >>>from a import x > > I'm doing that: > import Module.Data as Data Well, that's not quite the same. You're using Module.Data as Data - I guess you'v

Re: Project-wide variable...

2011-06-23 Thread Noah Hall
On Thu, Jun 23, 2011 at 2:41 PM, Gnarlodious wrote: > Is there a way to declare a project-wide variable and use that in all > downstream modules? Well, the standard way you should do it is to use import to import a certain variable - for example - a.py - x = 3 >>>from a import x >>>x 3 -- ht

Re: python 3 constant

2011-06-22 Thread Noah Hall
On Wed, Jun 22, 2011 at 7:54 PM, sidRo wrote: > How to declare a constant in python 3? There aren't true constants in Python, but instead we use a standard defined by PEP 8, which states constants are in all caps, for example, PI = 3.14, as opposed to pi = 3.14 which could change (according to PE

Re: what happens inside?

2011-06-22 Thread Noah Hall
On Wed, Jun 22, 2011 at 4:45 PM, Chetan Harjani wrote: > why tuples are immutable whereas list are mutable? Because an immutable data type was needed, and a mutable type was also needed ;) > why when we do x=y where y is a list and then change a element in x, y > changes too( but the same is not

Re: Better way to iterate over indices?

2011-06-21 Thread Noah Hall
On Tue, Jun 21, 2011 at 7:05 PM, Billy Mays wrote: > I have always found that iterating over the indices of a list/tuple is not > very clean: > > for i in range(len(myList)): >    doStuff(i, myList[i]) > I know I could use enumerate: > > for i, v in enumerate(myList): >    doStuff(i, myList[i]) >

Re: What is this syntax ?

2011-06-19 Thread Noah Hall
On Sun, Jun 19, 2011 at 2:41 PM, candide wrote: > With Python 2.7 : > x="foo" print '"'+x+'"' > "foo" > What is this curious syntax on line 2 ? Where is it documented ? Just to make it clear to you what is happening - >>> x = "foo" >>> print ' " ' + x + ' " ' " foo " >>> Anyway, it'

Re: Free Software University - Python Certificate

2011-03-22 Thread Noah Hall
On Tue, Mar 22, 2011 at 11:30 AM, Giovani wrote: >> I don't know whether this site is useful or not. >> >> Assuming this site is serious: >> If you are already subscribed you might be able to give some feedback. >> >> One can't even see the list of courses without regsitering. >> This is very unpr

Re: Some Minor questions on Class and Functions

2011-03-20 Thread Noah Hall
> class Message: >    def __init__(self,string1,string2,lenstr1,lenstr2): >        self.string1="MY" >        self.string2="NAME" >        self.lenstr1=lenstr1 >        self.lenstr2=lenstr2 The variables string1 and string2 that you're passing here are in fact useless. They don't do anything insid

Re: How Translate This PHP

2011-03-06 Thread Noah Hall
On Sun, Mar 6, 2011 at 3:11 PM, Victor Subervi wrote: > Ah. I thought I had to "return" something! Well, based on what you asked, you would've, but based on the code, all it was doing is printing "returnValue - value" Of course, a better way of doing it would be to use formatting - For example,

Re: How Translate This PHP

2011-03-06 Thread Noah Hall
On Sun, Mar 6, 2011 at 2:45 PM, Victor Subervi wrote: > Hi; > How do I translate this PHP code? > > if($ok){ >     echo "returnValue=1"; > }else{ >     echo "returnValue=0"; > } >From the code provided - if ok: print 'returnValue=1' else: print 'returnValue=0' -- http://mail.python.org/

Re: learn the network program of python

2011-03-04 Thread Noah Hall
On Fri, Mar 4, 2011 at 12:47 PM, loopzhong001 wrote: > Dear All, >     Would anyone tell me haow to start? Well, to start on this mailing list - 1) Name the networking framework/modules you want to use (if you have one, else say "can someone suggest a networking framework/module?") 2) Say what y

Re: Newbie getting desperate with for

2011-02-18 Thread Noah Hall
On Fri, Feb 18, 2011 at 4:54 PM, Michael Torrie wrote: > On 02/17/2011 04:10 PM, Werner wrote: > Just for your information, your code is the equivalent of: > > while True: >    temp = range(2000) > > The for loop does absolutely nothing in your case.  After the range is > computed, the for loo

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Noah Hall
On Wed, Feb 2, 2011 at 9:25 PM, Emile van Sebille wrote: > ActivePython 2.6.1.1 (ActiveState Software Inc.) based on > Python 2.6.1 (r261:67515, Dec  5 2008, 13:58:38) [MSC v.1500 32 bit (Intel)] > on > win32 > Type "help", "copyright", "credits" or "license" for more information. import sys

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-02 Thread Noah Hall
On Wed, Feb 2, 2011 at 7:44 PM, rantingrick wrote: >> On Feb 1, 11:23 am, rantingrick wrote: >> > py> troll_group.append("Red John") > py> flamer_group.append(troll_group.pop("Corey Richardson")) Out of interest, what interpretor uses "py>"? I've never seen any. Just sayin'. -- http://mail.pyt

Re: IDLE: A cornicopia of mediocrity and obfuscation.

2011-02-01 Thread Noah Hall
ll) > Bryan ? (annoying troll) > Corey Richarson > Nicholas Devenish > Alexander Kapps > rusi ? > Andre ? > Geremy Condra (troll-wagoneer) > Ethan Furman > Noah Hall > Adam Skutt > Arndt Rodger Schnieder > Mark Roseman (Tkinter's minion) These people, includi

Re: WxPython versus Tkinter.

2011-01-24 Thread Noah Hall
On Mon, Jan 24, 2011 at 5:57 PM, rantingrick wrote: > Why don't you just tell him to shut the hell up Mark? > accidentally quoting me too much. You guys are very disappointing to > this community. Everyone here needs a voice. We must never engage in > behaviors that would limit speech from our c

Re: WxPython versus Tkinter.

2011-01-23 Thread Noah Hall
On Sun, Jan 23, 2011 at 5:31 PM, rantingrick wrote: > So far only trolls (besides Terry, Octavian, D'Aprano) have replied. > In my time here within the Python community i have only met one person > who shares my in-depth knowledge of Tkinter. That person is Kevin > Waltzer. So outside of Python-de

Re: newby qn about functions

2011-01-18 Thread Noah Hall
> """how can i use a return statement  to write a function that returns the > string "Testing Functions-lower case: "and the lowercase representation of > its string parameter""" If I uncomment the above, nothing outputs to > console:( def lower_case(s): return "Testing Functions-lower case: %

Re: python only prints integers

2011-01-06 Thread Noah Hall
On Fri, Jan 7, 2011 at 3:32 AM, Edward A. Falk wrote: > In article < > cd9d1c80-b1d2-4d20-9896-a6fd77bd7...@j25g2000yqa.googlegroups.com>, > Ian wrote: > > > >In Python 3, the '/' operator always performs true division. > > How can I get integer division? > > -- >-Ed Falk, f...@despams.

Re: python only prints integers

2011-01-06 Thread Noah Hall
On Thu, Jan 6, 2011 at 10:49 PM, francesco wrote: > I'm pretty new in Python language. I have a problem with numbers: it > seems python doesn't know any more how to count! > I get only the down rounded integer > 20/8 = 2 > 8/3=2 > I probably changed some option to round the numbers, but I don't >

Re: Python programming

2010-12-22 Thread Noah Hall
The most Pythonic ways of checking if a value is within a list is to use the "in" keyword, for example, using your data - 5 in [2, 6, 5] Which will return True, as 5 is in the list. You can then use this in the following generic way - if variable in list: do_things Where variable is the varible y