Re: Representation of floats (-> Mark Dickinson?)

2011-09-07 Thread Mark Dickinson
On Sep 7, 4:58 am, casevh wrote: > IIRC, Python > 3.2 changed (for floats) __str__ to call __repr__. Yes, exactly: str and repr of a float are identical in Python 3.2 + I'm also puzzled by the 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] [...] >>> 1.1 * 1.1 1.21 in jmf's

Re: Advice on how to get started with 2D-plotting ?

2011-09-07 Thread Weinhandl Herbert
Am 06.09.2011 20:27, schrieb Fred Pacquier: Hi, I'm a Python long-timer, but I've never had to use tools like Matplotlib& others before. Now, for my work, I would need to learn the basics fast, for a one-time quick-n-dirty job. This involves a graphic comparison of RFC1918 IP subnets allocatio

Prequisites required to learn Django frame work

2011-09-07 Thread Shambhu Rajak
Hi, I have been doing python development since last year, I think I should learn the famous Django frame work. Can any one suggest what are the perquisite required to setup django on my local home machine. Please suggest something that does not require a separate server, as this is a personal i

Re: Looking for open-source Python projects to help out with

2011-09-07 Thread Alec Taylor
Hi Tyler, I'm currently working on building a new kind of social-network for Users-Groups, Game-Clans & Student-Groups. Building it using DJango with Pinax. Detailed Feature-Set (planned): • Event management • Conference management (including ticketing with payment-gateway integration) • Video+A

Re: Representation of floats (-> Mark Dickinson?)

2011-09-07 Thread jmfauth
On 7 sep, 08:56, Mark Dickinson wrote: > On Sep 7, 4:58 am, casevh wrote: > > > IIRC, Python > > 3.2 changed (for floats) __str__ to call __repr__. > > Yes, exactly:  str and repr of a float are identical in Python 3.2 + > > I'm also puzzled by the > > 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC

Re: Looking for open-source Python projects to help out with

2011-09-07 Thread Fayaz Yusuf Khan
On Wednesday, September 07, 2011 01:09:51 PM Alec Taylor wrote: > Hi Tyler, > > I'm currently working on building a new kind of social-network for > Users-Groups, Game-Clans & Student-Groups. > > Building it using DJango with Pinax. > > Detailed Feature-Set (planned): > • Event management > • Co

Re: Relative seeks on string IO

2011-09-07 Thread Pierre Quentel
> > Please post code without non-code indents, like so: > Sorry about that. After the line "Example :" I indented the next block, out of habit ;-) > > What system are you using? Does it have a narrow or wide unicode build? > (IE, what is the value of sys.maxunicode?) > I use Windows XP Pro, version

Re: Floating point multiplication in python

2011-09-07 Thread Gelonida N
On 09/07/2011 06:51 AM, Steven D'Aprano wrote: 11258999068426240 > > Error in float 1.1*1.1: > b = F(11, 10)**2 y = F.from_float(1.1**2) f = y - b print f > 21/112589990684262400 > > which is slightly more than double e above, and slightly less than our > estimate of 2*a*e =

Re: Prequisites required to learn Django frame work

2011-09-07 Thread Gelonida N
Hi Shambhu, On 09/07/2011 09:25 AM, Shambhu Rajak wrote: > Hi, > > I have been doing python development since last year, I think I should > learn the famous Django frame work. > > > > Can any one suggest what are the perquisite required to setup django on > my local home machine. > Just eas

Re: Looking for open-source Python projects to help out with

2011-09-07 Thread Alec Taylor
The project page is: http://SamuelMarks.GitHub.com/groupHub /me is thinking a rename to "groupSwitch", thoughts? The project is currently in planning stage. All help is appreciated. On Wed, Sep 7, 2011 at 6:32 PM, Fayaz Yusuf Khan wrote: > On Wednesday, September 07, 2011 01:09:51 PM Alec Taylo

Re: Installing WebDAV server

2011-09-07 Thread Fokke Nauta
"Dennis Lee Bieber" wrote in message news:mailman.823.1315377607.27778.python-l...@python.org... > On Tue, 6 Sep 2011 21:26:12 +0200, "Fokke Nauta" > declaimed the following in > gmane.comp.python.general: > >> (here I try to login the WebDAV server with the local IE browser) >> >> INFO:fshan

Re: Floating point multiplication in python

2011-09-07 Thread Terry Reedy
On 9/7/2011 12:51 AM, Steven D'Aprano wrote: So given a float x, when you square it you get this: Exact values: a*a = a**2 Float values: x*x = (a+e)(a+e) = a**2 + 2*a*e + e**2 So the error term has increased from e to (2*a*e+e**2). It is usual to assume that e**2 is small e

Re: Installing WebDAV server

2011-09-07 Thread becky_lewis
> I have re-installed Python and the setuptool, and tried the Python version > of Active, but it did not make a difference. > So now I use the "old" Python 2.7 again. Used easy_install to install > PyWebDAV. I now run davserver.exe from the Script directory. Still the same > problem. > What I found

Re: Portable locale usage

2011-09-07 Thread ssegvic
On 6 ruj, 22:58, garabik-news-2005...@kassiopeia.juls.savba.sk wrote: > Thomas Jollans wrote: > > It looks like you don't actually care about the encoding: in your first > > example, you use the default system encoding, which you do not control, > > and in your second example, you're using two dif

Re: Portable locale usage

2011-09-07 Thread ssegvic
On 6 ruj, 17:53, Thomas Jollans wrote: > On 06/09/11 16:46, ssegvic wrote: > > > For the moment, I only wish to properly sort a Croatian text file > > both on Windows and Linux (I am a cautious guy, I like reachable > > goals). > > When the locale is properly set, sorting works like a charm > > wi

Re: Portable locale usage

2011-09-07 Thread ssegvic
On 6 ruj, 17:53, Thomas Jollans wrote: > On 06/09/11 16:46, ssegvic wrote: > > > For the moment, I only wish to properly sort a Croatian text file > > both on Windows and Linux (I am a cautious guy, I like reachable > > goals). > > When the locale is properly set, sorting works like a charm > > wi

Re: Portable locale usage

2011-09-07 Thread Thomas Jollans
On 07/09/11 12:39, ssegvic wrote: > On 6 ruj, 17:53, Thomas Jollans wrote: >> On 06/09/11 16:46, ssegvic wrote: >> >>> For the moment, I only wish to properly sort a Croatian text file >>> both on Windows and Linux (I am a cautious guy, I like reachable >>> goals). >>> When the locale is properly

Re: Looking for open-source Python projects to help out with

2011-09-07 Thread Thomas Jollans
On 07/09/11 04:19, Littlefield, Tyler wrote: > Hello: > I've got a bit of time on my hands, so I'm curious what sorts of > projects there are that people needs help with. I'd like to choose > something that doesn't have a ton of red tape, but is stable, which is > why I ask here instead of just Goo

Re: Installing WebDAV server

2011-09-07 Thread Fokke Nauta
"becky_lewis" wrote in message news:d26f81b2-f87e-46f1-bb4e-8ef1943df...@c29g2000yqd.googlegroups.com... >> I have re-installed Python and the setuptool, and tried the Python >> version >> of Active, but it did not make a difference. >> So now I use the "old" Python 2.7 again. Used easy_install

web2py

2011-09-07 Thread Vineet Deodhar
>>>-- Hi, I have been doing python development since last year, I think I should learn the famous Django frame work. Can any one suggest what are the perquisite required to setup django on my local home machine. Please suggest something that does not requir

Re: Portable locale usage

2011-09-07 Thread Laszlo Nagy
1. Is there a way for writing portable Python code dealing with locales (as sketched in the beginning)? I usually do this at the top of my main program, before importing other modules: import locale locale.setlocale(locale.LC_ALL, '') This is absolutely portable. The above snippet work

Re: Looking for open-source Python projects to help out with

2011-09-07 Thread Eric Snow
On Tue, Sep 6, 2011 at 8:19 PM, Littlefield, Tyler wrote: > Hello: > I've got a bit of time on my hands, so I'm curious what sorts of projects > there are that people needs help with. I'd like to choose something that > doesn't have a ton of red tape, but is stable, which is why I ask here > inste

How to structure packages

2011-09-07 Thread bclark76
I'm learning python, and was playing with structuring packages. Basically I want to have a package called mypackage that defines a number of classes and functions. so I create: mypackage __init__.py myfunc.py MyClass.py my __init__.py is blank. my MyClass.py looks like: import b

Re: Looking for open-source Python projects to help out with

2011-09-07 Thread Alec Taylor
Accessibility? Hmm, you could look at http://groups.google.com/group/django-users/browse_thread/thread/44a4dbf8771e0f4f (https://groups.google.com/forum/#!topic/django-users/RKTb-HceD08) On Thu, Sep 8, 2011 at 1:12 AM, Eric Snow wrote: > On Tue, Sep 6, 2011 at 8:19 PM, Littlefield, Tyler > wro

Re: How to structure packages

2011-09-07 Thread John Gordon
In <2a4f542c-a8c1-46c7-9899-a3fad0940...@x11g2000yqc.googlegroups.com> bclark76 writes: > mypackage > __init__.py > myfunc.py > MyClass.py > from mypackage import MyClass Try this instead: from mypackage.MyClass import MyClass -- John Gordon A is for Amy, who

Re: How to structure packages

2011-09-07 Thread Rafael Durán Castañeda
Check python pep8: http://www.python.org/dev/peps/pep-0008/ And you will see than you shouldn't named modules as you did, so you should do something like: mypackage __init__.py mymodule ... mypackage.mymodule.MyClass On 07/09/11 18:11, John Gordon wrote: In<2a4f542c-a8c1-46c7-98

Re: How to structure packages

2011-09-07 Thread Peter Otten
bclark76 wrote: > I'm learning python, and was playing with structuring packages. If you are coming from Jave you have to unlearn a thing or two. > Basically I want to have a package called mypackage that defines a > number of classes and functions. > I'm trying to follow the rule that every f

Re: How to structure packages

2011-09-07 Thread rantingrick
On Sep 7, 10:56 am, bclark76 wrote: > I'm learning python, and was playing with structuring packages. > > Basically I want to have a package called mypackage that defines a > number of classes and functions. > > so I create: > > mypackage >     __init__.py >     myfunc.py >     MyClass.py Don't t

Re: How to structure packages

2011-09-07 Thread Littlefield, Tyler
On 9/7/2011 9:56 AM, bclark76 wrote: I'm learning python, and was playing with structuring packages. Basically I want to have a package called mypackage that defines a number of classes and functions. so I create: mypackage __init__.py myfunc.py MyClass.py my __init__.py is b

Re: PEP 20 - Silly Question?

2011-09-07 Thread Emile van Sebille
On 9/6/2011 6:31 PM Joshua Miller said... You sure it wasn't the invisible one? you know the one in the white text that blends into the background? Aah! So _that's_ significant whitespace! :) Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: Advice on how to get started with 2D-plotting ?

2011-09-07 Thread Fred Pacquier
Wow, what an impressive turnout ! Thanks a lot, rantingrick, CM and Herbert, for the fast answers, useful tips and especially the sample code ! Beats starting from a blank page, with a big stick, and will certainly set me on my way much faster... networkx does seem a bit over the top for my si

Re: Portable locale usage

2011-09-07 Thread Siniša Šegvić
> From: "Laszlo Nagy" > To: "ssegvic" , python-list@python.org > Sent: Wednesday, September 7, 2011 4:51:20 PM > Subject: Re: Portable locale usage > > 1. Is there a way for writing portable Python code dealing with > > locales (as sketched in the beginning)? > I usually do this at the top of my m

Re: Adding a ranking based on two fields

2011-09-07 Thread noydb
On Aug 25, 4:53 pm, Chris Rebert wrote: > On Thu, Aug 25, 2011 at 1:38 PM, noydb wrote: > > Hello All, > > > Looking for some advice/ideas on how to implement arankingto a > > 'scores' field I have.  So this scores field has values ranging from > > 1.00-4.  There is also a count field.  I want to

Re: MIMEText encode error - Python 2.6.6

2011-09-07 Thread neubyr
On Tue, Sep 6, 2011 at 5:05 PM, MRAB wrote: > On 06/09/2011 22:52, neubyr wrote: >> >> I am trying to write a program which can email file's content using >> smtplib. I am getting following error while using Python 2.6.6 >> version. >> >> {{{ >> File "./killed_jobs.py", line 88, in sendmail >>    

Re: Portable locale usage

2011-09-07 Thread Thomas Jollans
On 07/09/11 20:33, Siniša Šegvić wrote: > I expect that most of my Windows users will not care > to configure their computers with the national locale > (and besides, that does not seem to work, anyway). Are, on Windows, the default system region/language setting, and the locale, distinct? (And,

Re: How to structure packages

2011-09-07 Thread Westley Martínez
First of all MyClass.py should be renamed to myclass.py. Module names should be lowercase. Secondly, put this in __init__.py: from .myclass import MyClass and there you go. On Wed, Sep 07, 2011 at 08:56:32AM -0700, bclark76 wrote: > I'm learning python, and was playing with structuring pac

Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
Hi there, What is the simplest way to check that you are at the beginning or at the end of an iterable? I'm using enumerate with Python 3.2 (see below) but I'm wondering if there would be a better way. l = ['a', 'b', 'a', 'c'] for pos, i in enumerate(l): if pos == 0: print("head =

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Cameron Simpson
On 07Sep2011 14:35, Laurent wrote: | What is the simplest way to check that you are at the beginning or at | the end of an iterable? I'm using enumerate with Python 3.2 (see below) | but I'm wondering if there would be a better way. | | l = ['a', 'b', 'a', 'c'] | | for pos, i in enumerate(l): |

Re: Installing WebDAV server

2011-09-07 Thread Piet van Oostrum
"Fokke Nauta" writes: > INFO:DAVServer.fshandler:get_data: d:\webdav not found > XXX --- [07/Sep/2011 11:57:48] - Mozilla/5.0 UJindows NT 5.1; rv:6.0.1> > Gecko/ > 20100101 Firefox/6.0.1 - "GET / HTTP/1.1" 404 - > XXX --- [07/Sep/2011 11:57:52] - Mozilla/5.0 > Gecko/ > 20100101 Firefox/6.0.1

I am confused by

2011-09-07 Thread Martin Rixham
Hi all I would appreciate some help understanding something. Basically I am confused by the following: >>> a = [[0, 0], [0, 0]] >>> b = list(a) >>> b[0][0] = 1 >>> a [[1, 0], [0, 0]] I expected the last line to be [[0, 0], [0, 0]] I hope that's clear enough. Martin -- http://mail.python.org/m

Re: Why do class methods always need 'self' as the first parameter?

2011-09-07 Thread Piet van Oostrum
"Prasad, Ramit" writes: > It seems to me that if I add a function to the list of class attributes it > will automatically wrap with "self" but adding it to the object directly will > not wrap the function as a method. Can somebody explain why? I would have > thought that any function added to

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
I totally understand the performance issue that an hypothetical "istail" would bring, even if I think it would just be the programmer's responsibility not to use it when it's not certain that an end can be detected. But I don't see why *adding* something like "ishead" would be so bad (at worse

Re: Installing WebDAV server

2011-09-07 Thread Fokke Nauta
"Piet van Oostrum" wrote in message news:m2zkigartn@cochabamba.vanoostrum.org... > "Fokke Nauta" writes: > > >> INFO:DAVServer.fshandler:get_data: d:\webdav not found >> XXX --- [07/Sep/2011 11:57:48] - Mozilla/5.0 UJindows NT 5.1; rv:6.0.1> >> Gecko/ >> 20100101 Firefox/6.0.1 - "GET / HTTP/

Re: I am confused by

2011-09-07 Thread MRAB
On 07/09/2011 23:57, Martin Rixham wrote: Hi all I would appreciate some help understanding something. Basically I am confused by the following: >>> a = [[0, 0], [0, 0]] >>> b = list(a) >>> b[0][0] = 1 >>> a [[1, 0], [0, 0]] I expected the last line to be [[0, 0], [0, 0]] I hope that's cl

Re: I am confused by

2011-09-07 Thread Gary Herron
On 09/07/2011 03:57 PM, Martin Rixham wrote: Hi all I would appreciate some help understanding something. Basically I am confused by the following: >>> a = [[0, 0], [0, 0]] >>> b = list(a) >>> b[0][0] = 1 >>> a [[1, 0], [0, 0]] I expected the last line to be [[0, 0], [0, 0]] I hope that's c

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Cameron Simpson
On 07Sep2011 16:22, Laurent wrote: | I totally understand the performance issue that an hypothetical | "istail" would bring, even if I think it would just be the programmer's | responsibility not to use it when it's not certain that an end can | be detected. The trouble with these things is that

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Steven D'Aprano
Laurent wrote: > Hi there, > > What is the simplest way to check that you are at the beginning or at the > end of an iterable? I don't think this question is meaningful. There are basically two fundamental types of iterables, sequences and iterators. Sequences have random access and a length,

Re: How to structure packages

2011-09-07 Thread Steven D'Aprano
Peter Otten wrote: > Classes and functions are grouped into > submodules by their functionality rather than employing Java's mechanical > one-class-per-file pattern. Surely it's an anti-pattern? I suppose "one class per file" might be useful for those using an editor with no search functionality

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Miki Tebeka
I guess enumerate is the best way to check for first argument. Note that if someone passes you the iterator as argument you have now way of checking if the consumed items from it. istail can be implemented using itertools.chain, see https://gist.github.com/1202260 -- http://mail.python.org/mai

Re: Floating point multiplication in python

2011-09-07 Thread Christophe Chong
And then we learned in class what happens when you're calculating "0.1" with different precision in the industry. http://www.ima.umn.edu/~arnold/disasters/patriot.html Beware. On Tue, Sep 6, 2011 at 3:14 AM, Thomas Rachel < nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de> wrot

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
Yes of course the use of a boolean variable is obvious but I'm mixing python code with html using Mako templates. In Mako for code readability reasons I try to stick to simple "for" and "if" constructions, and I try to avoid variables declarations inside the html, that's all. Thanks anyway. --

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Tim Chase
On 09/07/11 18:22, Laurent wrote: Anyway I was just asking if there is something better than enumerate. So the answer is no? The fact that I have to create a tuple with an incrementing integer for something as simple as checking that I'm at the head just sounds awfully unpythonic to me. I've ma

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Terry Reedy
On 9/7/2011 8:23 PM, Cameron Simpson wrote: On 07Sep2011 16:22, Laurent wrote: | I totally understand the performance issue that an hypothetical | "istail" would bring, even if I think it would just be the programmer's | responsibility not to use it when it's not certain that an end can | be det

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
Yes, I was just hoping for something already included that I wouldn't know (i'm new to Python). -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
Interesting. I will check that yield functionality out. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Terry Reedy
On 9/7/2011 8:24 PM, Steven D'Aprano wrote: I don't think this question is meaningful. There are basically two fundamental types of iterables, sequences and iterators. And non-sequence iterables like set and dict. Sequences have random access and a length, so if the "start" and "end" of the

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Laurent
> I don't think this question is meaningful. There are basically two > fundamental types of iterables, sequences and iterators. > > Sequences have random access and a length, so if the "start" and "end" of > the sequence is important to you, just use indexing: > > beginning = sequence[0] > end =

how to make fxn argument work with setting a field value

2011-09-07 Thread noydb
What do I need to do to line 14 code below to get it to recognize the field name and not the argument name? I get this error with below code at line 13, the print row.rankFld line >RuntimeError: Row: Field rankFld does not exist A field called rankFld does not, should not exist. rankFld is "RANKa

Re: Running Python Demo on the Web?

2011-09-07 Thread Laurent
Neat. But I can see some "print(x)" and some "print x". What is the Python version? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to make fxn argument work with setting a field value

2011-09-07 Thread MRAB
On 08/09/2011 02:32, noydb wrote: What do I need to do to line 14 code below to get it to recognize the field name and not the argument name? I get this error with below code at line 13, the print row.rankFld line RuntimeError: Row: Field rankFld does not exist A field called rankFld does not,

Re: Best way to check that you are at the beginning (the end) of an iterable?

2011-09-07 Thread Chris Rebert
On Wed, Sep 7, 2011 at 5:24 PM, Miki Tebeka wrote: > I guess enumerate is the best way to check for first argument. Note that if > someone passes you the iterator as argument you have now way of checking if > the consumed items from it. > > istail can be implemented using itertools.chain, see >

Re: How to structure packages

2011-09-07 Thread Chris Angelico
On Thu, Sep 8, 2011 at 10:29 AM, Steven D'Aprano wrote: > Peter Otten wrote: > >> Classes and functions are grouped into >> submodules by their functionality rather than employing Java's mechanical >> one-class-per-file pattern. > > Surely it's an anti-pattern? I don't think that's true; Java mer

Re: Running Python Demo on the Web?

2011-09-07 Thread Sahil Tandon
On Wed, 2011-09-07 at 18:40:23 -0700, Laurent wrote: > Neat. But I can see some "print(x)" and some "print x". What is the > Python version? See: http://docs.python.org/release/3.2.2/whatsnew/3.0.html#print-is-a-function http://www.python.org/dev/peps/pep-3105/ -- Sahil Tandon -- http://ma

my multi-download program can't finish

2011-09-07 Thread 守株待兔
here is the program, # basic structure,omit something import Queue import httplib2 import threading jobs = Queue.Queue() name=something #omit ,it is a web list to download for x in name: jobs.put(x) def download(): while not jobs.empty(): try: url

multi-down in threading module

2011-09-07 Thread 守株待兔
i want to download data in multiprocess ,i know the threading structure,but i can't finish it, would you mind to revise it ? any advice appreciated. [code] import urllib import threading URL = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1t1v&e=.csv"; symbols = ('GGP', 'JPM', 'AIG', '

Re: my multi-download program can't finish

2011-09-07 Thread Steven D'Aprano
On Thu, 8 Sep 2011 02:24 pm 守株待兔 wrote: [...] > try: > url = jobs.get() > hx = httplib2.Http() > resp, content = hx.request(url, headers=headers) > jobs.task_done() > except: > print "wr