Re: [Tutor] object representation

2010-03-05 Thread Dave Angel
spir wrote: On Thu, 04 Mar 2010 09:22:52 -0500 Dave Angel wrote: Still, slots are important, because I suspect that's how built-ins are structured, to make the objects so small. Sure, one cannot alter their structure. Not even of a direct instance of : o = object() o.n=1

Re: [Tutor] How to wrap ctype functions

2010-03-05 Thread Mark Tolonen
"Jan Jansen" wrote in message news:f17500b71003030943w606925edie41b41d6d64ef...@mail.gmail.com... Hi there, I wonder what's the best way to wrap given function calls (in this case ctype function calls but more generally built-in functions and those kinds). I have a huge c library and almost

[Tutor] My tutorial

2010-03-05 Thread ALAN GAULD
Apologies to any users of my tutorial who can't access it I am a victim of my own success and have bust the bandwidth limit on the web site for the month. I will need to upgrade my subscription package... Until then, apologies once more. The old V2 freenet site seems to still be available if yo

[Tutor] Collaborative Comp Sci education using Python

2010-03-05 Thread Serdar Tumgoren
Hey everyone, A while back some folks said they were organizing an online study group to work through Wesley Chun's Core Python. I just stumbled into another online study group that might also be of interest: http://www.crunchcourse.com/class/mit-opencourseware-600-introduction/2010/jan/ The stud

Re: [Tutor] Encoding

2010-03-05 Thread Giorgio
> > >> Ok,so you confirm that: >> >> s = u"ciao è ciao" will use the file specified encoding, and that >> >> t = "ciao è ciao" >> t = unicode(t) >> >> Will use, if not specified in the function, ASCII. It will ignore the >> encoding I specified on the top of the file. right? >> >> >> > A literal "

Re: [Tutor] Understanding (Complex) Modules

2010-03-05 Thread bob gailer
Clarifications: A module is a file. It may or may not contain python code. If it does not an exception will be raised when importing. Import executes the module's code exactly the same as if the module had been run as a script (main program). References to module objects are stored in a dic

Re: [Tutor] object representation

2010-03-05 Thread Lie Ryan
On 03/05/2010 12:45 PM, Steven D'Aprano wrote: > E.g. a trie needs six pointers just to represent the single > key "python": > > '' -> 'p' -> 'y' -> 't' -> 'h' -> 'o' -> 'n' > > while a hash table uses just one: > > -> 'python' You can argue that had trie beed used as the datatype, there will

Re: [Tutor] Encoding

2010-03-05 Thread Dave Angel
Giorgio wrote: Ok,so you confirm that: s = u"ciao è ciao" will use the file specified encoding, and that t = "ciao è ciao" t = unicode(t) Will use, if not specified in the function, ASCII. It will ignore the encoding I specified on the top of the file. right? A literal "u" str

Re: [Tutor] Encoding

2010-03-05 Thread Giorgio
2010/3/5 Dave Angel > > In other words, you don't understand my paragraph above. Maybe. But please don't be angry. I'm here to learn, and as i've run into a very difficult concept I want to fully undestand it. > Once the string is stored in t as an 8 bit string, it's irrelevant what the > sour

[Tutor] import simplejson got Floating exception on RedHat

2010-03-05 Thread Ming Xue
Hi Tutors, I installed simplejson-2.0.9 for Python 2.5 using `setup.py install` on RedHad machine. The installation went through without any error and it created an egg (site-packages/simplejson-2.0.9-py2.5-linux-x86_64.egg). However when I tested in a python shell by import simplejson, I got

Re: [Tutor] Bowing out

2010-03-05 Thread Dave Kuhlman
On Wed, Mar 03, 2010 at 08:17:45AM -0500, Kent Johnson wrote: > Hi all, > > After six years of tutor posts my interest and energy have waned and > I'm ready to move on to something new. I'm planning to stop reading > and contributing to the list. I have handed over list moderation > duties to Alan

[Tutor] Process list elements as consecutive pairs

2010-03-05 Thread Rüdiger Wolf
Hi I am trying to Process list elements as consecutive pairs into consecutive pairs. Any pythonic suggestions? listin = [1,2,3,4,5,6,7,8,9,10] I want to process as consecutive pairs 1,2 3,4 5,6 7,8 9,10 Thanks Rudiger ___ Tutor maillist - Tutor@p

Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread greg whittier
On Fri, Mar 5, 2010 at 12:56 PM, Rüdiger Wolf < rudiger.w...@throughputfocus.com> wrote: > I am trying to Process list elements as consecutive pairs into > consecutive pairs. > Any pythonic suggestions? > > listin = [1,2,3,4,5,6,7,8,9,10] > I want to process as consecutive pairs > 1,2 > 3,4 > 5,6

Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread Wayne Werner
On Fri, Mar 5, 2010 at 11:56 AM, Rüdiger Wolf < rudiger.w...@throughputfocus.com> wrote: > Hi > > I am trying to Process list elements as consecutive pairs into > consecutive pairs. > Any pythonic suggestions? > > listin = [1,2,3,4,5,6,7,8,9,10] > I want to process as consecutive pairs > 1,2 > 3,

Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread عمـ نوفل ـاد
On Fri, Mar 5, 2010 at 1:03 PM, Wayne Werner wrote: > On Fri, Mar 5, 2010 at 11:56 AM, Rüdiger Wolf < > rudiger.w...@throughputfocus.com> wrote: > >> Hi >> >> I am trying to Process list elements as consecutive pairs into >> consecutive pairs. >> Any pythonic suggestions? >> >> listin = [1,2,3,4

Re: [Tutor] Encoding

2010-03-05 Thread Dave Angel
Giorgio wrote: 2010/3/5 Dave Angel In other words, you don't understand my paragraph above. Maybe. But please don't be angry. I'm here to learn, and as i've run into a very difficult concept I want to fully undestand it. I'm not angry, and I'm sorry if I seemed angry. Tone of v

Re: [Tutor] My tutorial

2010-03-05 Thread Alan Gauld
It's back. Enjoy Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread Hugo Arts
2010/3/5 Emad Nawfal (عمـ نوفل ـاد) : > > > Here is a general solution that I also took from the Tutor list some time > ago. It allows you to have consequences of (any) length. > def makeVectors(length, listname): > ...     """takes the length of the vector and a listname returns vectors""" >

[Tutor] Instantiating a list of strings into a list of classes

2010-03-05 Thread Daryl V
Hello All- I cut my teeth of Fortran95, and in the distant past rode the turtle, and while I enjoy the mind-bendy feeling of shifting my programming paradigm (and LOVE LOVE LOVE Python), I get sheepish when I feel I'm missing something basic. So: I have a csv list of data, of the form: plot, utmN

Re: [Tutor] Encoding

2010-03-05 Thread Mark Tolonen
"Giorgio" wrote in message news:23ce85921003050915p1a084c0co73d973282d8fb...@mail.gmail.com... 2010/3/5 Dave Angel I think the problem is that i can't find any difference between 2 lines quoted above: a = u"ciao è ciao" and a = "ciao è ciao" a = unicode(a) Maybe this will help: # co

Re: [Tutor] Instantiating a list of strings into a list of classes

2010-03-05 Thread Benno Lang
On 6 March 2010 10:38, Daryl V wrote: > I have a csv list of data, of the form: > plot, utmN83_X, utmN83_Y, plot_radius_m > Spring1,348545,3589235,13.2 > etc. > I built a nifty ClassGPSPoint(Xpos,Ypos,plotRadius,workPaths) that eats the > X&Y positions, the plot radius, and previously instantiated

[Tutor] Really miss the C preprocessor!!

2010-03-05 Thread Gil Cosson
I have some code to perform an exponential backoff. I am interacting with a few different web services. Checking for a specific Exception and then re-invoking the failed call after waiting a bit. I don't want to  code the backoff in ten different places. Really miss the C pre-processor. I am t

Re: [Tutor] Really miss the C preprocessor!!

2010-03-05 Thread Steven D'Aprano
On Sat, 6 Mar 2010 04:13:49 pm Gil Cosson wrote: > I have some code to perform an exponential backoff. I am interacting > with a few different web services. Checking for a specific Exception > and then re-invoking the failed call after waiting a bit. I don't > want to  code the backoff in ten diffe