Re: Problem with giant font sizes in tkinter

2011-02-16 Thread Rhodri James
On Tue, 15 Feb 2011 07:06:35 -, Steven D'Aprano wrote: On Sun, 13 Feb 2011 23:42:06 +, Rhodri James wrote: On Fri, 11 Feb 2011 02:08:01 -, Steven D'Aprano wrote: On Thu, 10 Feb 2011 15:48:47 +, Cousin Stanley wrote: Steven D'Aprano wrote: I have a tkin

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: IDLE won't wrap lines of text

2011-02-20 Thread Rhodri James
to discourage overly long lines. -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: IDLE won't wrap lines of text

2011-02-20 Thread Rhodri James
On Mon, 21 Feb 2011 01:41:12 -, Richard D. Moores wrote: On Sun, Feb 20, 2011 at 16:31, Rhodri James wrote: On Sat, 19 Feb 2011 23:56:45 -, Richard D. Moores wrote: Vista Python 3.1.3 I can't figure out how to get IDLE to wrap text pasted in from, say, a newspaper ar

Re: Running Scripts vs Interactive mode

2011-02-23 Thread Rhodri James
at). You'll want to edit the current PATH setting (in the lower half of the dialog) to add ";C:\python27" to the end. Obvious, isn't it :-/ -- Rhodri James *-* Wildebeest Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

s-expression parser in python

2010-04-06 Thread James Stroud
quot;, 5000.0] ] Note proper parsing of ints, floats, etc. I've already wrote the evaluator for the parsed lists, so I'm not interested in alternatives to S-expressions. Also, I'm really not interested in json, yaml, etc., for the configuration format because I'm quite fond

Re: python as pen and paper substitute

2010-04-06 Thread James Stroud
width : 2 length : 7 factor : 2 minor_axis : 48.290018647 It is not perfect but if it will help, I'll cheeseshop it. James -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex driving me crazy...

2010-04-07 Thread James Stroud
e. For example: "You are doing it wrong! Don't not do re.split('\s{2,}', s[2])." Please answer this way in the future. Thank you, James -- http://mail.python.org/mailman/listinfo/python-list

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

2010-04-20 Thread James Mills
J_TREE.png') > > class D(B,C): >    def __init__(self): >        B.__init__(self) ; OBJ_TREE.add_node(B,D) >        C.__init__(self) ; OBJ_TREE.add_node(C,D) >        OBJ_TREE.plot('OBJ_TREE.png') > > This is not good -- a lot of dumb code with chance to make mistakes Why not make things simple and just write a function that computes the edges of a class tree ? Something like this: http://codepad.org/xWKDlS52 cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: rfind bug ?

2010-04-21 Thread James Mills
ot;Return the highest index in S" I haven't looked at python's source code for the str object, but perhaps this is exactly what it's algorithm does! cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: how does a queue stop the thread?

2010-04-21 Thread James Mills
reading' module (which is a wrapper atop this). 'threading' aside from everything else it does, really in the end calls thread.start_new_thread(...) cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter question

2010-04-21 Thread James Mills
ed way - I was hoping it was possible to poll the Tk event system...). cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Hi, friends. I wanna ask if there is a function which is able to take a list as argument and then return its top-k maximums?

2010-04-22 Thread Rhodri James
umbers)[3:] [5, 7, 8] Now try returning the top two or four numbers. sorted(numbers)[-2:] [7, 8] sorted(numbers)[-4:] [4, 5, 7, 8] or in general sorted(numbers)[-k:] That said, reverse sorting is probably clearer, and might be marginally faster, though frankly I can't be bothe

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

2010-04-22 Thread James Mills
ion and therefore does not exceed python's limited recursion depth (configurable btw). cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: NameError: how to get the name?

2010-04-24 Thread James Mills
hat's be best way to implement the function > get_the_var_name(ne) that returns the name > of the variable that could not be found? A NameError Exception does not store the name of the variable. it has two attributes: .args and .message both of which contain (usually) a string such

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

2010-04-26 Thread James Mills
lly by calling 'start' and 'stop' on the script respectively). This can vary from across various distributions of Linux however and is normally something a package maintainer might do. I am not aware of any cross-platform way of performing what you're asking. cheers James --

Re: building python 3 -- _dbm necessary bits

2010-04-28 Thread James Mills
ment C headers for gdbm. If you're using a Debian-based system try something like: $ apt-get install gdbm-dev cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: help req installing python 2.6

2010-04-29 Thread James Mills
] cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: dynamic function add to an instance of a class

2010-04-29 Thread James Mills
ck (most recent call last): File "", line 1, in AttributeError: 'A' object has no attribute 'bar' >>> from types import MethodType >>> setattr(a, "bar", MethodType(bar, a)) >>> a.bar() 'bar' >>> a.foo > >>> a.bar > >>> cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: help req installing python 2.6

2010-04-29 Thread James Mills
on't actively use Debian/ubuntu based systems. Please consult your package manager and search for the "right package" to install. "You need to install the development packages" cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: printing table on the command line

2010-04-29 Thread James Mills
a tool called 'pysqlplus' that's much-like the mysql command-line tool but will also work for sqlite and oracle databases (if you have the python drivers installed). See: http://bitbucket.org/prologic/pymills/src/tip/pymills/table.py and http://bitbucket.org/prologic/tools/s

Re: building python 3 -- _dbm necessary bits

2010-04-29 Thread James Mills
ources and whether or not the python build scripts can pick it up ? (./configure) Also maybe check ./configure options (maybe you're system is different) ? Without knowing more about your system I can't offer any further useful advise. --james -- http://mail.python.org/mailman/listinfo/python-list

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

sometype.__new__ and C subclasses

2010-05-01 Thread James Porter
I've been trying to write a Python C extension module that uses NumPy and has a subtype of numpy.ndarray written in C. However, I've run into a snag: calling numpy.ndarray.__new__(mysubtype, ...) triggers an exception in the bowels of Python (this is necessary for a handful of NumPy features).

Re: sometype.__new__ and C subclasses

2010-05-02 Thread James Porter
On 5/2/2010 4:34 AM, Carl Banks wrote: Why don't you use mysubtype.__new__(mysubtype,...)? If you wrote mysubtype in C, and defined a different tp_new than ndarray, then this exception will trigger. And it ought to; you don't want to use ndarray's tp_new to create an object of your subclass, if

Re: sometype.__new__ and C subclasses

2010-05-02 Thread James Porter
On 5/2/2010 1:43 PM, Robert Kern wrote: Perhaps things would be clearer if you could post the C code that you've written that fails. So far, you've only alluded at what you are doing using Python-syntax examples. I'm not sure how much this will help, but here you go. The actual C code probably

Re: sometype.__new__ and C subclasses

2010-05-02 Thread James Porter
On 5/2/2010 3:58 PM, Robert Kern wrote: Well, I think we can change zeros_like() and the rest to work around this issue. Can you bring it up on the numpy mailing list? def zeros_like(a): if isinstance(a, ndarray): res = numpy.empty(a.shape, a.dtype, order=a.flags.fnc) res.fill(0) res = res.view(

Re: Sphinx hosting

2010-05-04 Thread James Mills
y (which is it's own repository) and commit a bunch of .html files. cheers James 1. http://bitbucket.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Teaching Programming

2010-05-04 Thread James Mills
> tell me please: how can generate the same output (depending on A and B) >> without control structure? i mean in a natural "pythonic" way... >>> def quadratic(a, b): ... return a + b if a > b else a**b - b**2 ... >>> a, b = 2, 3 >>> print quadratic(a, b) -1 >>> a, b = 3, 2 >>> print quadratic(a, b) 5 >>> --james -- http://mail.python.org/mailman/listinfo/python-list

Re: Teaching Programming

2010-05-04 Thread James Mills
uot;, "copyright", "credits" or "license" for more information. >>> a, b = 2, 3 >>> print a + b if a > b else a**b - b**2 -1 >>> a, b = 3, 2 >>> print a + b if a > b else a**b - b**2 5 >>> --James -- http://mail.python.org/mailman/listinfo/python-list

Re: python gui

2010-05-04 Thread James Mills
ful resources. --james -- http://mail.python.org/mailman/listinfo/python-list

Re: Teaching Programming

2010-05-04 Thread James Mills
perience of non-indentation sensitive languages such as C-class (curly braces) it's just as hard to keep track of opening and closing braces. --James -- http://mail.python.org/mailman/listinfo/python-list

Re: Sharing a program I wrote

2010-05-04 Thread James Harris
code would be responsible for explaining its licence and will include other relevant documentation. For my own code on codewiki I include installation instructions as text, where necessary. > I really just want anyone who might need a little networking/security > tool like this to be ab

Re: Sphinx hosting

2010-05-04 Thread James Mills
may be wrong, but I recall that Google Code Hosting's Wiki Engine has a macro that will allow you to render raw HTML. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Sphinx hosting

2010-05-04 Thread James Mills
port rendering text/html mime-type files in the repository (like Trac can). On a side-note, not sure if you're interested in this at all... I wrote (for the hell/fun of it) a "Sphinx Server", here's the code: http://codepad.org/ywo8pscb This uses the latest development version

Re: Sharing a program I wrote

2010-05-05 Thread James Harris
On 5 May, 04:25, Scott wrote: > James, > > Thanks for the comprehensive reply. I would like to post it to > comp.lang.python but the main file is 169 lines long and the file for > functions is 316 lines long. I'm thinking that is a little long for > this format. You'

Re: Create a new process to run python function

2010-05-05 Thread James Mills
Process(target=func, args=("1",)).start() multiprocessing.Process(target=func, args=("2",)).start() ... Surprise surprise it has almost the same API as the threading module :) --James -- http://mail.python.org/mailman/listinfo/python-list

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 --

Re: shortcut for large amount of global var declarations?

2010-05-08 Thread James Mills
ered bad practise. Consider instead using a class/object. You could for example have a "config" object that is shared by other modules. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract all words that begin with x

2010-05-10 Thread James Mills
_of_strings if word[0] == 'a'] > ['awes', 'asdgas'] I would do this for completeness (just in case): >>>> [word for word in list_of_strings if word and word[0] == 'a'] Just guards against empty strings which may or may not be in the list. --James -- http://mail.python.org/mailman/listinfo/python-list

Re: inherit from data type

2010-05-11 Thread James Mills
"help", "copyright", "credits" or "license" for more information. >>> class MyFloat(float): ... def __repr__(self): ... return "MyFloat(%f)" % self ... >>> x = MyFloat(3.1415926535897931) >>> x MyFloat(3.141593) >>> --James -- http://mail.python.org/mailman/listinfo/python-list

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
y),chunksize): >    h.send(body[i:i+chunksize]) >    show_progressinfo() > > > But how could I create body step by step? > I wouldn't know the content-length up front? > > thanks in advance My suggestion is to find some tools that can send multiple chucks of data

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

Re: joining two column

2010-05-14 Thread James Mills
s: > > a1 a2 b1 b2 > a3 a4 b3 b4 > a5 a6 b5 b6 > a7 a8 b7 b8 > > how to do that? This is completely untested, but this "should" (tm) work: from itertools import chain input1 = open("input1.txt", "r").readlines() input2 = open("i

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/list

Re: an element from a set

2010-05-14 Thread James Mills
turning it into a sequence (list) unless the underlying data of a set were exposed. --James -- http://mail.python.org/mailman/listinfo/python-list

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/mailm

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
22 0 22 C This had better not be yet another assignment you're asking us to help you with ? *sigh* Break your problem down! Since you haven't really asked a specific question I can't give you a specific answer. --James -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables for python applications

2010-05-16 Thread James Mills
pplication. If you have to use global variables in your application you are designing it WRONG! Python has powerful support for object orientated programming. Use it! I highly recommend the Python tutorial - especially the section on classes. --James -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables for python applications

2010-05-16 Thread James Mills
module shared as a static value. Anything else should be an object that you share. Don't get into the habit of using global variables! --james -- http://mail.python.org/mailman/listinfo/python-list

Re: global variables in imported modules

2010-05-16 Thread Rhodri James
of "config.x", in main it would be "mod.config.x". -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: global variables in imported modules

2010-05-16 Thread James Mills
)? Yes it does unless you re-assign it. --James -- http://mail.python.org/mailman/listinfo/python-list

Re: Global variables for python applications

2010-05-16 Thread James Mills
but > it predated threading. To be honest, classes work just fine for defining constants. (Though in my own code I use ALL UPPER CASE variables as it the style). --James -- http://mail.python.org/mailman/listinfo/python-list

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

Call for papers: SETP-10, USA, July 2010

2010-05-17 Thread James Heralds
-site dining — all situated on 10 tropically landscaped acres. Here, guests can experience a full- service resort with discount hotel pricing in Orlando. We invite draft paper submissions. Please see the website http://www.PromoteResearch.org for more details. Sincerely James Heralds -- http

Re: Global variables for python applications

2010-05-17 Thread Rhodri James
On Mon, 17 May 2010 05:29:20 +0100, Steven D'Aprano wrote: On Sun, 16 May 2010 18:57:15 -0700, John Nagle wrote: James Mills wrote: The only place global variables are considered somewhat "acceptable" are as constants in a module shared as a static value. Python reall

Re: What's the matter with docs.python.org?

2010-05-19 Thread Rhodri James
rking fine for me, using Opera on Window and Ubuntu, for the last week or so. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Where does "make altinstall" put stuff?

2010-05-29 Thread James Mills
his documented somewhere? > >  I want to make sure that no part of the existing Python installation > on Fedora Core is overwritten by an "altinstall" of 2.6. Check the generated Makefile (created by ./configure) --James -- http://mail.python.org/mailman/listinfo/python-list

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: CTYPES structure passing

2010-06-03 Thread Rhodri James
ace the union object with an integer zero? Do you mean FrameFormat.XUnion.subSample = 0 FrameFormat.XUnion.binning = 0 instead? FrameFormat.flagsX = 0 FrameFormat.YUnion = 0 Ditto here? -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

Re: Drop Table w/ MySQLdb?

2010-06-06 Thread James Mills
your MySQL server version for the right syntax to > use near ''127541158007'' at line 1") > > But when I print that statement out (exchanging the comma for a %) and > manually enter it: > > mysql> drop table tmp127541158007; > Query OK, 0 rows af

Re: map is useless!

2010-06-06 Thread James Mills
s execution time ? I must be missing something! --James -- 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: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 "va

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
y of the string s with only its first character capitalized. """ The behavior you've demonstrated is "exactly" what the documentation says the .capitalize() method does. --James -- http://mail.python.org/mailman/listinfo/python-list

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
in > situations like this where you'd like to encapsulate lower level stuff > for neophyte users but make it easily available to advanced users? Use a container instead and pass this around. eg: an Environment class. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Community (A Modest Proposal)

2010-06-12 Thread James Mills
thers" were willing to put "their time" and effort into doing the work. Also I should point out that no-one is going to take you seriously when you publically point out your 1.5 years experience in using (what projects have you actively worked on and contributed to?) Python. Have a nice day, cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: file handling

2010-06-13 Thread James Mills
the input file line-by-line and give you a list of those lines. If (however) there are no line endings in the file, you'll get a list with only 1 item (the entire contents of the file). Maybe this is what you're confused about ? cheers James -- http://mail.python.org/mailman/listinfo/python-list

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/ -- -- "Pro

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

2010-06-14 Thread James Mills
fear to do something bad by myself.. > please help! Just run the python-2.4 binary. There will likely be a /usr/bin/python-2.4 or similar. cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: python local web server

2010-06-14 Thread James Mills
ing. In addition to my good colleagues sound advise: There are many many web frameworks available in the Python world of all things wonderful. But first, "Learn Python". Then pick a web framework that best suites your needs and "Learn" it. cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Community (A Modest Proposal)

2010-06-15 Thread James Mills
s the beauty with vim is you just read the line no. type it in and hit ^G IDEs are over glorified IHMO and yes I've had my fair share of them with things like Delphi, Visual Basic, Visual Studio, and others... --James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Python Library Win7 -64 Bit

2010-06-15 Thread James Ravenscroft
he right direction? The only solution I could come up with was to compile python itself from scratch which, even on a high end desktop, takes hours and hours and hours... (etc) on an Msys setup. Thanks, James Ravenscroft Funky Monkey Software james (at) funkymonkeysoftware (dot) com -- http://mail.python.org/mailman/listinfo/python-list

Re: a +b ?

2010-06-16 Thread James Mills
d. Are you sure you meant that ? What in particular do you _not_ enjoy about using map/reduce (and possibly other functional features of the Python programing language) ? --James Quantification of "experience" is meaningless. -- -- -- "Problems are solved by method" --

Re: a +b ?

2010-06-16 Thread James Mills
Further: What is "Pythonic" ? This is probably more of a style and personal taste that might vary from one programmer to another. I don't recall anywhere in the Python documentation or a Python document that says map/reduce is or isn't "pythonic" (whatev

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 b

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
e_object.other_attr.attr or your solution which is however > longer to type :) It would actually help to see some code. --James -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this make sence? Dynamic assembler for python

2010-06-20 Thread Rhodri James
h hardware, and if you are doing that, Python wasn't the best place to start from. -- Rhodri James *-* Wildebeeste Herder to the Masses -- http://mail.python.org/mailman/listinfo/python-list

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: Is this make sence? Dynamic assembler for python

2010-06-21 Thread Rhodri James
On Mon, 21 Jun 2010 04:34:40 +0100, Steven D'Aprano wrote: On Sun, 20 Jun 2010 22:45:14 +0100, Rhodri James wrote: No. Modern C compilers often produce very good machine code, but the best hand-written assembly code will be better. I can usually write *very* marginally better code

Re: Redirecting STDOUT to a Python Variable

2010-06-22 Thread James Mills
() against it and find out what's going on. I'm not familiar with this library (either), however you would be better off digging through it's documentation and/or it's sources and find out how to change where it logs errors to. --James -- -- -- "Problems are solved by

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread James Mills
th reading. So there you go... Sorry I can't offer you a real objective response! cheers James -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread James Mills
ly - and again sorry if there are any Python/Rub* dualists!) -- When I came across Rub* I found it to be just a rip-off of Python (in some respects) and couldn't understand how it became popular so quickly :) It's not that great really! --James -- -- -- "Problems are solved by metho

Re: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
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. cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Should I Learn Python or Ruby next?

2010-06-22 Thread James Mills
vailable on PyPi (1). cheers James 1. http://pypi.python.org/ -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: From Dict to Classes yes or no and how

2010-06-22 Thread James Mills
in some fashion. You could also subclass (you'll learn about this) the dict class creating your own customized dict (if you will). The former approach may be better suited however instead of diving into things you may not yet come to fully understand until you really learn the inner workings o

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

2010-06-22 Thread James Mills
g a mapping of user -> user record. You select a user record by key. >>> users["Bob Jane"] Your example of a user record if perfectly fine to me. If you wanted to iterate over all user records: >>> for k, v in users.items(): ... # some code here cheers James -- --

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

2010-06-22 Thread James Mills
I iterate through and access an individual user record! > > Thanks in advance, I'm not sure what's wrong with your email client but I already answered this for you. To access an individual record given that you have a dict called "users" that holds a mapping of us

Re: Book review / advise

2010-06-22 Thread James Mills
ly going to even need a pretty book now are you ? :) (No phun intended! --james -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple list problem that's defeating me!

2010-06-22 Thread James Mills
of sorts ? If so, do you have the actual problem description ? It's often better to come up with a different (perhaps better) solution without looking at someone else's :) --james -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Book review / advise

2010-06-22 Thread James Mills
ies I mentioned above) would > make everyone's life easier. Like I said, no "phun" intended :) I don't know any off hand and reading printed material is not something I enjoy! :) --James -- http://mail.python.org/mailman/listinfo/python-list

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

2010-06-22 Thread James Mills
gt; def foo(): pass ... >>> type(foo) >>> isbuiltin(foo), isclass(foo), isfunction(foo) (False, False, True) >>> type(open) >>> isbuiltin(open), isclass(open), isfunction(open) (True, False, False) >>> Notice anything ? --James PS: The Python REPL is your friend :) -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

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

2010-06-22 Thread James Mills
e source code cannot be retrieved. """ This "does not" include an object / instance (whichever you prefer). $ python main.py class A: pass $ cat main.py import inspect class A: pass a=A() print inspect.getsource(a.__class__) cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Information about PHP + MySQL E-book

2010-06-22 Thread James Mills
on has MySQL drivers. --James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

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

<    26   27   28   29   30   31   32   33   34   35   >