Re: Extending classes __init__behavior for newbies

2011-02-15 Thread James Mills
ot;. Agreed, test-driven development tends to lend itself to higher quality code. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: interrupted system call w/ Queue.get

2011-02-17 Thread James Mills
What causes the exception?  Is it necessary to catch this exception > and manually retry the Queue operation?  Thanks. Are you getting this when your application is shutdown ? I'm pretty sure you can safely ignore this exception and continue. cheers James -- -- James Mills -- -- "

Re: HOW TO build object graph or get superclasses list for self.__class__ ?

2010-04-20 Thread James Mills
On Wed, Apr 21, 2010 at 3:35 PM, Dmitry Ponyatov wrote: > Hello > > Help please with such problem: > > I need to build program object graph (data structure) with additional > parameters for nodes and edges: > > include nxgraph # data structure module allowes any py objects for > node/edge id > # (

Re: rfind bug ?

2010-04-21 Thread James Mills
On Wed, Apr 21, 2010 at 6:51 PM, Stef Mientki wrote: > > With the following code, I would expect a result of 5 !! > a= 'word1 word2 word3' a.rfind(' ',7) > 11 > > Is this a bug ? Python's documentation states: | rfind(...) | S.rfind(sub [,start [,end]]) -> int | | Return

Re: how does a queue stop the thread?

2010-04-21 Thread James Mills
On Wed, Apr 21, 2010 at 7:36 PM, kaiix wrote: > before i wrote the email, i've already read the python docs carefully. > i need the proof from code, i mean python source code. i tried to > prove some of my assumptions that lead the loop quit, and i traced > back to Queue.py, threading.py, dummy_th

Re: Tkinter question

2010-04-21 Thread James Mills
On Wed, Apr 21, 2010 at 8:45 PM, Rotwang wrote: > def draw(self, w, h): >        out = Tkinter.Canvas(width = w, height = h) >        # a load of out.create_line(...)'s go here >        out.pack() >        out.mainloop() > > It works, but the problem is that I can't do anything else with IDLE unti

Re: Re: HOW TO build object graph or get superclasses list for self.__class__ ?

2010-04-22 Thread James Mills
2010/4/22 : > In production system I'll have 100+ subclasses and you code is not appliable > ;) > But -- thanks for __bases__ , it's thing I needed and py helpfile does not > give me __bases__ easy Feel free to rewrite my edges(...) function so it does not use tail recursion and therefore does

Re: NameError: how to get the name?

2010-04-24 Thread James Mills
On Sat, Apr 24, 2010 at 9:19 PM, Yingjie Lan wrote: > I wanted to do something like this: > > while True: >  try: >    def fun(a, b=b, c=c): pass >  except NameError as ne: >    name = get_the_var_name(ne) >    locals()[name] = '' >  else: break > > What's be best way to implement the function > g

Re: Detect OS shutdown or user logout across different operating systems

2010-04-26 Thread James Mills
On Tue, Apr 27, 2010 at 12:09 PM, wrote: > Is there a OS portable way to have a Python script detect when its operating > system is shutting down or a user is logging out? In the Linux world, you would normally create an rc/init style script that is invoked at boot and shutdown (usually by calli

Re: building python 3 -- _dbm necessary bits

2010-04-28 Thread James Mills
On Thu, Apr 29, 2010 at 1:12 PM, Mark Olbert wrote: > I'm getting an error message about make not being able to find the necessary > bits to build modules related to _dbm. Yet I have > libgdbm installed installed on my system. Suggestions on how to fix this? You need the development C headers fo

Re: help req installing python 2.6

2010-04-29 Thread James Mills
2010/4/29 sanam singh : > hi, > i am am facing problem in installing python 2.6 on ubuntu 9.04. When i sudo > make i get following error : You need to install the necessary development headers/libraries required to build Python from source. eg: $ sudo apt-get install gdbm-dev [ snip ] cheers J

Re: dynamic function add to an instance of a class

2010-04-29 Thread James Mills
On Thu, Apr 29, 2010 at 5:55 PM, Richard Lamboj wrote: > i want to add functions to an instance of a class at runtime. The added > function should contain a default parameter value. The function name and > function default paramter values should be set dynamical. The normal way of doing this by b

Re: help req installing python 2.6

2010-04-29 Thread James Mills
2010/4/29 sanam singh : > hi, > it is saying > sa...@ubuntu:~/Desktop/Python-2.6.5$ sudo apt-get install gdbm-dev > Reading package lists... Done > Building dependency tree > Reading state information... Done > E: Couldn't find package gdbm-dev I'm sorry, but I don't actively use Debian/ubuntu bas

Re: printing table on the command line

2010-04-29 Thread James Mills
On Thu, Apr 29, 2010 at 6:03 PM, Daniel Dalton wrote: > Hello, Hi, > Any examples of how to do this would be great, as I'm blind and it's a > bit difficult to check the spacing. You're welcome to adapt some of my old code written just for this very purpose. I even have a tool called 'pysqlplus'

Re: building python 3 -- _dbm necessary bits

2010-04-29 Thread James Mills
On Fri, Apr 30, 2010 at 3:00 AM, Mark Olbert wrote: > Okay. But I compiled & installed gdbm from source obtained from the gnu > archive, so I presume the necessary files would be included > (this is on a linux system). Perhaps check where gdbm has installed it's development sources and whether o

Re: http://pypi.python.org/pypi

2010-04-29 Thread James Mills
On Fri, Apr 30, 2010 at 5:53 AM, gert wrote: > How do you upload a plain text .py file as a source file? http://lmgtfy.com/?q=python+distutils+tutorial -- http://mail.python.org/mailman/listinfo/python-list

Re: Sphinx hosting

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 5:27 PM, Michele Simionato wrote: > Cool, that's good to know. I am still accepting recommendations for > non-Python projects ;) bitbucket (1) also provide static file hosting through the wiki. From what I understand (tested) you simply clone the wiki repository (which is i

Re: Teaching Programming

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:43 PM, Stefan Behnel wrote: >> Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45) >> [GCC 4.3.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >>  >>> A,B=2,3 >>  >>> if A>B: >> ... print A+B >> ... else: >> ... print A**B-B**2 >> ... >>

Re: Teaching Programming

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:56 PM, superpollo wrote: > of course! *but* if i must generate on-the-fly python code that defines a > function i am back again to the problem: One-liner: $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type "help", "copyright", "cr

Re: python gui

2010-05-04 Thread James Mills
On Tue, May 4, 2010 at 9:26 PM, a wrote: > where's the best online resource for teaching about GUI building? There are many many resources available on the topic. If you simply Google (tm) some of the keywords in your post you'll be presented with a whole smorgasbord of useful resources. --james

Re: Teaching Programming

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 12:21 AM, Ed Keith wrote: > To deal with indentation I had to > >   1) keep track of indentation of all chunks of code embedded in the >      document and indent inserted chunks to the sum of all the >      indentation of the enclosing chunks. In my experience of non-indent

Re: Sphinx hosting

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 2:08 PM, Michele Simionato wrote: > Interesting. I tried to see if the same was true for the Wiki in > Google code but apparently it does not work. Does anybody here know if > it is possible to publish raw html in the Google Code wiki and how > does it work? I may be wrong,

Re: Sphinx hosting

2010-05-04 Thread James Mills
On Wed, May 5, 2010 at 3:35 PM, Michele Simionato wrote: > I am sure it has, but I was talking about just putting in the > repository an index.html file and have it published, the wayI hear  it > works in BitBucket and GitHub. I'm pretty sure Google Code Hosting doesn't support rendering text/htm

Re: Create a new process to run python function

2010-05-05 Thread James Mills
On Wed, May 5, 2010 at 10:56 PM, Massi wrote: > in my script (python 2.5 on windows xp) I need to run a simple > function in a separate process. In other words I need something > similar to the fork function under UNIX. I tried with threads: Use the new multiprocesing package. > import os, threa

Re: is there a functional assert(x==y, 'error msg')

2010-05-07 Thread James Mills
On Sat, May 8, 2010 at 12:04 PM, Vincent Davis wrote: > Is there a functional assert(x==y, 'error msg') ? > I can only find the assert that is used like; > assert x==y, 'error msg' > What about: def assertfunc(expr, msg): assert expr, msg cheers James -- http://mail.python.org/mailman/listi

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread James Mills
On Sun, May 9, 2010 at 12:08 AM, Alex Hall wrote: > Hi all, > I am sorry if this is the second message about this you get; I typed > this and hit send (on gmail website) but I got a 404 error, so I am > not sure if the previous message made it out or not. > Anyway, I have about fifteen vars in a f

Re: Extract all words that begin with x

2010-05-10 Thread James Mills
On Mon, May 10, 2010 at 6:50 PM, Xavier Ho wrote: > Have I missed something, or wouldn't this work just as well: > list_of_strings = ['2', 'awes', '3465sdg', 'dbsdf', 'asdgas'] [word for word in list_of_strings if word[0] == 'a'] > ['awes', 'asdgas'] I would do this for completeness (ju

Re: inherit from data type

2010-05-11 Thread James Mills
On Tue, May 11, 2010 at 6:38 PM, Richard Lamboj wrote: > i want to inherit from a data type. How can i do this? Can anyone explain more > abou this? How knows python that it is a float, or a string? $ python Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49) [GCC 4.4.1 (CRUX)] on linux2 Type "help"

Re: Slice last char from string without raising exception on empty string (Re: Extract all words that begin with x)

2010-05-11 Thread James Mills
On Wed, May 12, 2010 at 2:01 AM, wrote: >> word[len(word)-1:] This works just as well: >>> word[-1:] cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: client to upload big files via https and get progress info

2010-05-13 Thread James Mills
On Wed, May 12, 2010 at 6:48 PM, News123 wrote: > Hi, > > I'd like to perform huge file uploads via https. > I'd like to make sure, > - that I can obtain upload progress info (sometimes the nw is very slow) > - that (if the file exceeds a certain size) I don't have to >  read the entire file into

Re: use only files but ignore directories on Windows

2010-05-13 Thread James Mills
On Fri, May 14, 2010 at 6:12 AM, albert kao wrote: > My program plan to use only files but ignore directories on Windows. > I google but do not find some functions like > bool isFile(string) > bool isDirectory(string) > Please help. Try looking up the os module. cheers James -- http://mail.pyth

Re: joining two column

2010-05-14 Thread James Mills
On Sat, May 15, 2010 at 3:22 AM, mannu jha wrote: > Hi, > > I have two different file > > file1: > > a1 a2 > a3 a4 > a5 a6 > a7 a8 > > file2: > > b1 b2 > b3 b4 > b5 b6 > b7 b8 > > and I want to join them so the output should look like this: > > a1 a2 b1 b2 > a3 a4 b3 b4 > a5 a6 b5 b6 > a7 a8 b7 b8

Re: joining two column

2010-05-14 Thread James Mills
On Sat, May 15, 2010 at 4:46 AM, Tim Chase wrote: > I think you meant izip() instead of chain() ... the OP wanted to be able to > join the two lines together, so I suspect it would look something like You're quite right! My mistake :) --James -- http://mail.python.org/mailman/listinfo/python-li

Re: an element from a set

2010-05-14 Thread James Mills
On Sat, May 15, 2010 at 4:23 PM, Carl Banks wrote: > Which brings up an interesting question: how do you get a random > element from a set? > > random.choice(list(s)) > > is the most straightforward way and will work a lot of the time, but > how would you avoid creating the list?  I can't think of

Re: help need to write a python spell checker

2010-05-15 Thread James Mills
On Fri, May 14, 2010 at 6:19 PM, harry k wrote: > Write a spell checking tool that will identify all misspelled word in a text > file using a provided dictionary. Is this an assignment ? Sure looks like it! I don't see a question anywhere. --james -- http://mail.python.org/mailman/listinfo/py

Re: Access to comp.lang.python

2010-05-15 Thread James Mills
On Sun, May 16, 2010 at 3:12 PM, Aahz wrote: > It's also at least partly due to problems with mail<->news gateways and > the differing fields used to maintain threading. Some blame goes on MUAs too :) -- http://mail.python.org/mailman/listinfo/python-list

Re: joining files

2010-05-16 Thread James Mills
On Sun, May 16, 2010 at 5:02 PM, mannu jha wrote: > Hi, > > I have few files like this: > file1: > 22 110.1 > 33 331.5 22.7 > 5 271.9 17.2 33.4 > 4 55.1 > > file1 has total 4 column but some of them are missing in few row. > > file2: > 5 H > 22 0 > > file3: > 4 T > 5 B > 22 C > 121 S > > in all th

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 3:50 AM, AON LAZIO wrote: > Hi, >    How can I set up global variables for the entire python applications? > Like I can call and set this variables in any .py files. >    Think of it as a global variable in a single .py file but this is for the > entire application. If you

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 4:00 AM, Krister Svanlund wrote: > On Sun, May 16, 2010 at 7:50 PM, AON LAZIO wrote: >>    How can I set up global variables for the entire python applications? >> Like I can call and set this variables in any .py files. >>    Think of it as a global variable in a single .

Re: global variables in imported modules

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 8:26 AM, vsoler wrote: > However, can I be 100% sure that,no matter how I access variable > 'x' (with config.x or mod.config.x) it is always the same 'x'. I mean > that either reference of 'x' points to the same id(memory position)? Yes it does unless you re-assign it. --

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 11:57 AM, John Nagle wrote: >   For one thing, it's fine to share constants across threads, while > sharing globals is generally undesirable.  Also, more compile-time > arithmetic becomes possible. > >   Python does have a few built-in named unassignable constants: > "True"

Re: Global variables for python applications

2010-05-16 Thread James Mills
On Mon, May 17, 2010 at 2:24 PM, Steven D'Aprano wrote: > In what way are they constant? Can you not modify them and rebind them? It's just style/convention :) Much like _ to denote private variables and methods! --james -- http://mail.python.org/mailman/listinfo/python-list

Re: Where does "make altinstall" put stuff?

2010-05-29 Thread James Mills
On Sun, May 30, 2010 at 4:06 PM, John Nagle wrote: > I know that one is supposed to use "make altinstall" to install > versions of Python that won't be the "primary" version.  But what > directory names does it use for packages and other support files? > Is this documented somewhere? > >  I want t

Re: What's the largest python/django powered website in the world?

2010-05-30 Thread James Mills
On Mon, May 31, 2010 at 9:27 AM, est wrote: > Except Google/youtube, what's next? bitbucket (1) is mostly implemented in Python cheers James 1. http://bitbucket.org/ -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Drop Table w/ MySQLdb?

2010-06-06 Thread James Mills
On Mon, Jun 7, 2010 at 1:07 AM, Victor Subervi wrote: > Hi; > I tried this: > >     cursor.execute('drop table tmp%s', tmpTable) > > and got this error: > > Traceback (most recent call last): >   File "/var/www/html/angrynates.com/cart/cart.py", line 196, in ? >     cart() >   File "/var/www/html/

Re: map is useless!

2010-06-06 Thread James Mills
On Mon, Jun 7, 2010 at 1:16 AM, rantingrick wrote: > So can anyone explain this poor excuse for a map function? Maybe GVR > should have taken it out in 3.0?  *scratches head* Let me get this straight... You're complaining about some trivial code you've written and a 0.002 or less execution time ?

Re: Drop Table w/ MySQLdb?

2010-06-06 Thread James Mills
On Mon, Jun 7, 2010 at 1:40 AM, MRAB wrote: > As has been explained already, SQL might not (and here it clearly does > not) let you use placeholders for table or column names, only for > values. Yes I should have stated that '?' place-holders are used only for "values" :) *sigh* --James -- http

Re: map is useless!

2010-06-07 Thread James Mills
On Mon, Jun 7, 2010 at 9:20 AM, Steven D'Aprano wrote: >> Ruby has a very nice map > > I'm thrilled for them. Personally I think the syntax is horrible. I concur! --James -- http://mail.python.org/mailman/listinfo/python-list

Re: capitalize() NOT the same as var[0].upper _ var[1:]

2010-06-08 Thread James Mills
2010/6/9 Victor Subervi : > Sorry, Dennis: > > var = 'colorsShort' > var[0].upper + var[1:] = 'ColorsShort' > var.capitalize() = 'Colorsshort' """ string.capitalize = capitalize(s) capitalize(s) -> string Return a copy of the string s with only its first character capitalized. """ Th

Re: assign class variable in __init__

2010-06-08 Thread James Mills
On Wed, Jun 9, 2010 at 6:36 AM, Mark Lawrence wrote: > Yes alright bloody Aussies  ** n * sodit * *wink*.  Not sure if this is a > syntax error, but too lazy too test at an interactive prompt. I resent that remark :) --James -- http://mail.python.org/mailman/listinfo/python-list

Re: Good solutions for passing around large numbers of arguments in a layered architecture?

2010-06-11 Thread James Mills
On Sat, Jun 12, 2010 at 3:00 AM, Nathan Rice wrote: > I've tried using args/kwargs, however I found it difficult to avoid > having arguments in my signature re-ordered, and it is also a source > of bugs. > > Has anyone come up with a good solution for dealing with arguments in > situations like th

Re: Community (A Modest Proposal)

2010-06-12 Thread James Mills
On Sun, Jun 13, 2010 at 1:57 PM, Jack Diederich wrote: > On Sat, Jun 12, 2010 at 11:09 PM, rantingrick wrote: >> >> - >>  Where is the community? >> - > [snip] [snip] > In various threads you haven't met the minimum qualifications to be > taken se

Re: file handling

2010-06-13 Thread James Mills
On Mon, Jun 14, 2010 at 3:35 PM, madhuri vio wrote: > i have a doubt about ...this..can u look into this.. > > a = open("human.odt","r") > b = a.readlines() > print b > > and i get d output something else... > > python monday.py > ["PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<^\xc62\x0c'\x00\x00\x

Re: what are some good python modules?

2010-06-14 Thread James Mills
On Mon, Jun 14, 2010 at 5:02 PM, Robin wrote: > What are some good python modules that can be downloaded for any > purpose that is recomended? That's a rather vauge question Robin. There are tonnes of packages on PyPi (1). cheers James 1. http://pypi.python.org/ -- -- "Problems are solved by

Re: how to build with 2.4 having 2.6 as main python

2010-06-14 Thread James Mills
On Mon, Jun 14, 2010 at 6:30 PM, Alexzive wrote: > what to change in order to get "python" calling python 2.4.3 instead > of 2.6.4 (at least during python setup.py build)? > > I suppose I need something like changing the link to /usr/local/bin/ > python.. > but I fear to do something bad by myself

Re: python local web server

2010-06-14 Thread James Mills
On Tue, Jun 15, 2010 at 2:44 PM, alex23 wrote: > shanti bhushan wrote: >> Please guide me the design or direct me the best approach to do all >> this. > > The best approach? > > 1. Study > 2. Learn > 3. Apply > > There you go, the advice that keeps on giving. In addition to my good colleagues so

Re: Community (A Modest Proposal)

2010-06-15 Thread James Mills
On Tue, Jun 15, 2010 at 5:30 PM, Steven D'Aprano wrote: > But other than that, I don't > see the advantage of an IDE. What am I missing? You're not missing anything my dear watson :) I myself use vim (as my editor) and 2-3 Terminals on virtual workspaces (in my DE). I guess the beauty with vim i

Re: a +b ?

2010-06-16 Thread James Mills
On Thu, Jun 17, 2010 at 12:37 PM, Aahz wrote: > And I am not particularly fond of map() and cordially loathe reduce(). > Speaking as someone with more than twenty years of programming before > encountering Python more than a decade ago. "Loathe" is a particularly STRONG world. Are you sure you me

Re: a +b ?

2010-06-16 Thread James Mills
On Thu, Jun 17, 2010 at 1:34 PM, Aahz wrote: >>"Loathe" is a particularly STRONG world. Are you sure you meant that ? > > Yes, I did mean to use it -- perhaps it is not entirely an accurate > description of my emotional state, but I enjoy the shock effect in this > circumstance. > >>What in partic

Re: a +b ?

2010-06-16 Thread James Mills
On Thu, Jun 17, 2010 at 2:23 PM, Stephen Hansen wrote: > It could certainly do with a little less 'taking oneself too seriously' :) You do realize my question was completely rhetorical :) --James /me withdraws from this discussion :) -- -- -- "Problems are solved by method" -- http://mail.py

Re: a +b ?

2010-06-16 Thread James Mills
On Thu, Jun 17, 2010 at 2:43 PM, James Mills wrote: > /me withdraws from this discussion :) Of course - thank you for that enlightening description of "Pythonic" :) Hopefully it helps others to understand! :) -- -- -- "Problems are solved by method" -- http://mail.pyth

Re: a +b ?

2010-06-16 Thread James Mills
On Thu, Jun 17, 2010 at 2:53 PM, Stephen Hansen wrote: > My entire response was largely tongue-in-cheek :) I know :) Don't you wish there was a "Close Thread" button :) -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: variable variables

2010-06-18 Thread James Mills
On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: > I was looking for a "short way" to do it because I have a lot > "some_object.attr.attr or some_object.other_attr.attr" in code. it > looks like I cannot replace attr with just other variable and must > type some_object.other_attr.attr or your solut

Re: __slot__: what is it good for?

2010-06-21 Thread James Mills
On Tue, Jun 22, 2010 at 12:27 AM, Alexander Eisenhuth wrote: > Hello out there, > > - what is the reason, that __slots__ are introduced in python? > > - I want to use slots to define a class where no attributes are added at > runtime. Is that a good idea to use slots for that? Here is the relevan

Re: Redirecting STDOUT to a Python Variable

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 4:10 PM, Anthony Papillion wrote: > I'm writing an application that uses the Google Storage Python > library.  When an error occurs, the error is printed on the terminal. > What I need to do is intercept that text into a variable so I can run > a re.search() against it and

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 6:58 PM, Josef Tupag wrote: > Before I really dive in, though, I'm curious to hear what others think about > the choice between these two languages. This is a terribly subjective opinion and I apologize to anyone that actually uses Ruby and likes it :) I find Ruby (compar

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 7:29 PM, Jean-Michel Pichavant wrote: > This is a python list, fully dedicated to our dutch semi God. So how can you > even immagine that someone here will suggest you to go for rub... sorry I > can't prononce this blasphemous name. Good call :) (Personally - and again sor

Re: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: > My input is NOT CSV, I used this format to try and make the question shorter. > Although I could create a CSV file, I'd > like to learn how to code a class to work the way I described in the question. Your input certainly looks CSV-ish to m

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 9:37 PM, Nathan Rice wrote: > As far as community support, Python has 4342 packages listed in sourceforge, > Ruby has 705.  Python is listed in ~0.4% of jobs at indeed.com's trend You are forgetting the 10278 (last count) or so packages, modules and what not available on P

Re: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 9:56 PM, Jerry Rocteur wrote: > As part of learning Python, I'm also learning OOP! That is why I want to know > if this is doable using classes. > > The input is not important, I end up with the dictionary as described in the > question and as I asked in the question, > I

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 10:03 PM, Jerry Rocteur wrote: > How do I iterate through and access an individual user record! A much better question! :) You are in fact already demonstrating that you know full well how to access a specific user record - by accessing a parent dictionary holding a mappi

Re: Second attempt WAS: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
On Tue, Jun 22, 2010 at 10:03 PM, Jerry Rocteur wrote: >> On Tue, Jun 22, 2010 at 9:32 PM, Jerry Rocteur wrote: >> If you were able to ask us perhaps a more specific question >> and describe your problem a little more concisely perhaps >> I (and we) might have a bit more to offer you. > > I have

Re: Book review / advise

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:14 AM, lallous wrote: > Well, it seems the printed version of the manual. Can anyone suggest a > nice book to learn more about the Python C Api? It's not really a book, but how about the source ? If you're a competent C programmer you're not really going to even need a

Re: Simple list problem that's defeating me!

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:06 AM, Neil Webster wrote: > I've got a simple problem but it's defeated me and I was wondering if > somebody could point out where I'm going wrong or offer an alternative > solution to the problem? Is this a hypothetical/mathematical problem of sorts ? If so, do you ha

Re: Book review / advise

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 12:27 AM, lallous wrote: > For me it is not a matter of competency to seek a book: organized, > structured and uniform way of presenting information. > > Nonetheless, I always refer to the sources to get my questions > answered...but a book (with the qualities I mentioned a

Re: Why 'open' is not a function according to inspect module?

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 1:42 AM, Peng Yu wrote: > 'open' is not a function according to inspect module. But according to > help(open), it is a function. Is there something wrong with inspect > module? $ python Python 2.6.5 (r265:79063, Jun 13 2010, 14:03:16) [GCC 4.4.4 (CRUX)] on linux2 Type "hel

Re: Why inspect.getsource() can not getsource for a class?

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 1:53 AM, Peng Yu wrote: > It seems I don't completely understand how getsource works, as I > expect that I should get the source code of class A. But I don't. > Would you please let me know what I am wrong? If you "read" the documentation carefully: """ getsource(objec

Re: Information about PHP + MySQL E-book

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 2:15 AM, J3p wrote: > Hi, I need some Information from you. Someone told me to buy E-book > about PHP + MySQL in > http://php-mysql-ebook.blogspot.com > Does anyone have experience about this? This has nothing whatsoever to do with Python except that Python has MySQL drive

Re: Information about PHP + MySQL E-book

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 6:10 AM, John Bokma wrote: > My guess is that this is just spam for a blog. Please don't copy > spamvertized URLs. My bad :/ -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Uses of a deprecated module 'string'

2010-06-22 Thread James Mills
On Wed, Jun 23, 2010 at 7:11 AM, Steven Howe wrote: > Hi, I'm trying to import 'letters' from the string module. > I get the following message: > >    Uses of a deprecated module 'string' > > I realize the functionality of 'string' is now in the _builtin_. But are the > constants. If so, what are

Re: Only one forum app in Python?

2010-07-09 Thread James Mills
On Fri, Jul 9, 2010 at 6:18 PM, Gilles Ganault wrote: > Is Pocoo really the only solution available out there? Did you bother to check pypi ? cheers James 1. http://pypi.python.org/ -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/li

Re: Only one forum app in Python?

2010-07-12 Thread James Mills
not a forum, but it's goals are to have a best-of-mix of features from blogging, wiki and cms engines. cheers James 1. http://sahriswiki.org/ -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: [ann] Hatta 1.4.0 wiki engine released

2010-07-21 Thread James Mills
On Wed, Jul 21, 2010 at 6:01 PM, Radomir Dopieralski wrote: > I'm proud to announce release 1.4.0 of Hatta wiki engine. Congrats. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: how to prevent the "extended call syntax" (*) from expanding a string into a list of characters

2010-07-21 Thread James Mills
On Thu, Jul 22, 2010 at 4:26 PM, fulv wrote: >  args = (connection_string) Replace this with: args = (connection_string,) NOTE: The trailing , (comma) indicating that this _is_ a tuple. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.pytho

Re: Where is the man page of python library

2010-07-23 Thread James Mills
On Sat, Jul 24, 2010 at 1:42 AM, rantingrick wrote: > In the land of the blind, the one eyed man is king! ;-) RIck, your comments don't really help the situation. Really. -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to run Python 2.7 on Windows 7 and any suggestions on books/websites for "dummies guide to python" type learning

2010-08-02 Thread James Mills
here i can find/get > something similar to the book for my own? Start with the mighty fine Python tutorial on the Python Documentation website (1) cheers James 1. http://docs.python.org/ -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: web and standalone access

2010-08-03 Thread James Mills
imenting myself with embedded circuits.web with pygtk and webkit with some success (similar to Adobe Air). cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
ot;automated clean-up side of the RAIL idiom" ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: PIL

2010-08-03 Thread James Mills
p me and let me know that how can I convert/save .xpm > files in PIL. > Reading PIL's documentation might help. Try: $ pydoc Image cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-03 Thread James Mills
On Tue, Aug 3, 2010 at 7:04 PM, Steven D'Aprano wrote: > True, but Nobody said it can't *readily* be implemented, not that it > can't be. So he did too :) I read that as "really" :/ --James -- -- James Mills -- -- "Problems are solved by method" --

Re: parsing tab and newline delimited text

2010-08-03 Thread James Mills
On Wed, Aug 4, 2010 at 12:14 PM, elsa wrote: > I have a large file of text I need to parse. Individual 'entries' are > separated by newline characters, while fields within each entry are > separated by tab characters. Sounds to me like a job of the csv module. cheers James

Re: Difference between queues and pipes in multiprocessing

2010-08-04 Thread James Mills
ons. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: lpr via subprocess in 2.4

2010-08-04 Thread James Mills
On Wed, Aug 4, 2010 at 9:38 PM, loial wrote: > I have also been trying to get the return code and standard error. p = Popen("..., stderr=PIPE) Look up the docs for subprocess.Popen cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.

Perl -> Python unpack

2010-08-06 Thread James Mills
Hey all, Quick question for you Python enthusiasts that also happen to know Perl quite well... What does a* or A* translate to in Python when unpacking binary data with struct.unpack(...) ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.o

Re: python interview quuestions

2010-08-06 Thread James Mills
w in some py3l questions > too) A common thing you can do in interviews is ask your interviewee to write (in Python) a solution to the "FizzBuzz" problem. Any good competent Python programmer should be able to do this in 5-10mins (5 if you're good). cheers james -- -- James

Re: python interview quuestions

2010-08-06 Thread James Mills
tually a very good point! Someone should post this very problem to this newsgroups/list and see how many active python programmers here actually "get it right" :) *evil grin* --james -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: python interview quuestions

2010-08-06 Thread James Mills
e done in just a single line of Python. 7 if you're not very familiar with Python. cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Perl -> Python unpack

2010-08-06 Thread James Mills
On Sat, Aug 7, 2010 at 4:30 AM, James Mills wrote: > What does a* or A* translate to in Python when unpacking > binary data with struct.unpack(...) ? Fine I"ll answer my own question. Python _does not_ support implicit size in struct formatting rules. sizes are explicit meaning th

GSM to ISO / UCS2 to ISO

2010-08-16 Thread James Mills
.java Thanks, cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: 79 chars or more?

2010-08-16 Thread James Mills
to do?  -andrei My personal opinion (despite monitors being wider) is the horizontal scrolling isn't worth it. Stick to a 80-char width. cheers james -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   >