Re: [Tutor] Filling orders FIFO

2011-07-16 Thread Izz ad-Din Ruhulessin
Why are you doing it at the low level? Have you consideren using a framework like Django for example? 2011/7/16 Steven D'Aprano > Charles John wrote: > >> Hi I am new to python and was wondering what the best way to create an >> order(bid and offer) queue, then match a bid and offer so that if >

Re: [Tutor] Hello World in Python without space

2011-07-10 Thread Izz ad-Din Ruhulessin
Sending args to the print command always puts spaces between them. Try: print("Hello {name}!".format(name=name)) 2011/7/10 Robert H > Dear all, > > > I have Python 3.2 installed on Windows 7. I am a complete beginner playing > around with the basic functions. My problem is the following sc

Re: [Tutor] Limit raw_input to hundredth decimal point

2011-07-01 Thread Izz ad-Din Ruhulessin
You can use a regular expression or plain simple len() 2011/7/1 Ryan Kirk > Is there a way to limit raw_input to the hundredth decimal point? > > For example, I'd like to allow the user to enter 5.75 but not 5.756: > > dollars = raw_input("Please enter a dollar amount: $") > > Thanks! >

Re: [Tutor] Objects C++ vs Python

2011-06-09 Thread Izz ad-Din Ruhulessin
Compared to Python, I do not even consider C++ an object oriënted language. 2011/6/9 Ashwini Oruganti > On Thu, Jun 9, 2011 at 2:18 PM, Alan Gauld wrote: > > C++ grew out of C so it has a lot of non OOP features. It is no >> surprise to find therefore that its primitive types are related to >> m

Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Izz ad-Din Ruhulessin
I forgot to mention strptime<http://docs.python.org/library/datetime.html#strftime-strptime-behavior> 2011/5/25 Izz ad-Din Ruhulessin > Hi Cory, > > From your description it seems to me that your case is more one of > asserting that your function received valid arguments

Re: [Tutor] Need help wrapping my head around duck typing

2011-05-24 Thread Izz ad-Din Ruhulessin
segfault) Will an incorrect type or value raise an exception in your proposed solutions? It probably will, so it is probably best to go for try-except-finally clauses. A sidenote: personnally I would glob the directory and then sort the list by file creation date. Kind regards, Izz ad-Din Ruhuless

Re: [Tutor] cpython

2011-05-12 Thread Izz ad-Din Ruhulessin
Hi, CPython is the C implementation of Python. You can read the tutorial in the Python docs. It is a rather advanced topic, however. If you nevertheless want to delve into it, it might be a good idea to check out www.cython.org first. 2011/5/12 tee chwee liong > hi all, > > i just started pyt

Re: [Tutor] Shared web host and setting the python environment...

2011-03-05 Thread Izz ad-Din Ruhulessin
Hi, I would go for appending sys.path. This is a simple way to do it, and perhaps not even needed for each python file (only files which use the modules that you have installed)) Another way to do it is adding the modules you need to sys.modules manually. 2011/3/5 Modulok > List, > > Backgroun

Re: [Tutor] A class that instantiates conditionally ?

2011-03-02 Thread Izz ad-Din Ruhulessin
Of course that would be: > foo = lambda condition: MyClass() if condition else None 2011/3/3 Izz ad-Din Ruhulessin > Maybe: > > foo = lambda x: MyClass() if condition else None > > > 2011/3/3 David > > Another classic case of trying something not the best way, due

Re: [Tutor] A class that instantiates conditionally ?

2011-03-02 Thread Izz ad-Din Ruhulessin
Maybe: foo = lambda x: MyClass() if condition else None 2011/3/3 David > Another classic case of trying something not the best way, due to > inexperience. > But it has been a good process: I learned something new from > setting myself the initial puzzle and then finding a solution,and then >

Re: [Tutor] Multiples python files

2011-02-28 Thread Izz ad-Din Ruhulessin
You can only call methods on a class without instantiating it, if it are classmethods. http://pyref.infogami.com/classmethod 2011/2/28 Christopher Brookes > I don't understand > > @classmethod > def DisplayAll(cls, herosAll > ): > > What is cls ? > >

Re: [Tutor] Multiples python files

2011-02-28 Thread Izz ad-Din Ruhulessin
@classmethod def DisplayAll(herosAll): is of course: @classmethod def DisplayAll(cls, herosAll): 2011/2/28 Izz ad-Din Ruhulessin > Hi, you must pass the herosAll list to the DisplayAll() method like this > > class Character(): > @classmethod > def Disp

Re: [Tutor] Multiples python files

2011-02-28 Thread Izz ad-Din Ruhulessin
Hi, you must pass the herosAll list to the DisplayAll() method like this class Character(): @classmethod def DisplayAll(herosAll): print ('There is', Character.CharacterCount, 'heros') for heros in herosAll: heros.DisplayCharacterInfos() herosAll = [ Character

Re: [Tutor] remote code execution

2011-02-15 Thread Izz ad-Din Ruhulessin
Just tested that, doesn't work. Have you considered installing SVN or any other version control system? 2011/2/15 Izz ad-Din Ruhulessin > Send your code as a raw text string and use eval on it maybe > > 2011/2/15 ian douglas > >> Sounds like it should be possible via

Re: [Tutor] remote code execution

2011-02-15 Thread Izz ad-Din Ruhulessin
Send your code as a raw text string and use eval on it maybe 2011/2/15 ian douglas > Sounds like it should be possible via SSH, but I have no idea how you'd > set that up within Eclipse. > > > On 02/15/2011 10:50 AM, S de Haan wrote: > > For instance, Im working on my local machine with Eclipse

Re: [Tutor] class question

2011-01-26 Thread Izz ad-Din Ruhulessin
class Raw ---> class Processor ---> class Final 2011/1/26 Tino Dai > > >> >> A raw casting comes into a factory. It is listed as such. When machined, >> this part number changes to a different part number. The raw casting has >> no "quality related" stuff, but the machined casting does, and

Re: [Tutor] The trap of the year

2011-01-25 Thread Izz ad-Din Ruhulessin
Or the internal memory id or whatever it's called. 2011/1/25 Izz ad-Din Ruhulessin > I think it has something to do with the physical id of the object > > 2011/1/25 Karim > > >> Hello All, >> >> Just to share on rageous bug I encounter where 2 lists whic

Re: [Tutor] The trap of the year

2011-01-25 Thread Izz ad-Din Ruhulessin
I think it has something to do with the physical id of the object 2011/1/25 Karim > > Hello All, > > Just to share on rageous bug I encounter where 2 lists which "should" to be > different (same id) because hold by different instances of the same class > are not in fact DIFFERENT, see below: > >

Re: [Tutor] Exactly duplicating strftime behavior?

2011-01-17 Thread Izz ad-Din Ruhulessin
Hi Hugo, Problem solved, thanks! Kind regards, Izz ad-Din 2011/1/17 Hugo Arts > On Mon, Jan 17, 2011 at 8:29 PM, Izz ad-Din Ruhulessin > wrote: > > Hi all, > > I'm designing a module which aims to provide full compatibility with > > Pythons' datetime mod

Re: [Tutor] Why super does not work !

2011-01-17 Thread Izz ad-Din Ruhulessin
It looks like because of something Observable doesn't have that attribute. Could you post the ListBox class? 2011/1/17 Karim > > > Hello, > > I implemented Observer DP on a listbox (Tkinter) as follows and I don't > understand why super() is not working and Observable.__init__(self) is > working

[Tutor] Exactly duplicating strftime behavior?

2011-01-17 Thread Izz ad-Din Ruhulessin
Hi all, I'm designing a module which aims to provide full compatibility with Pythons' datetime module. However, I can't find out how some operators in strftime function, namely: those who use the locale. (%a, %A, %b, etc.) How do I access this locale and it's values? Thanks in advance. Kind re

Re: [Tutor] Refcount in C extensions

2011-01-17 Thread Izz ad-Din Ruhulessin
operations could require tens or even hundreds of lines of code, Cython make life easiër. A real life-saver, thanks! I also like how simple it is to import C functions to python, btw. Kind regards, Izz ad-Din 2011/1/14 Stefan Behnel > Izz ad-Din Ruhulessin, 14.01.2011 19:49: > > Thanks f

Re: [Tutor] Python on Ubuntu 10.10?

2011-01-15 Thread Izz ad-Din Ruhulessin
Although I probably wont switch from Eclipse to vim, that looks nevertheless very, very nice, bookmarked. 2011/1/15 Sean Carolan > >>> I am new to programming and to Python. I've been using Python with > IDLE > >>> on Windows Vista for a few weeks now. > >>> (And I'm loving it!) However, I'm t

Re: [Tutor] Python on Ubuntu 10.10?

2011-01-15 Thread Izz ad-Din Ruhulessin
Install Eclipse via Synaptic and then PyDev via Eclipse. 2011/1/15 Timo > On 15-01-11 02:17, Joel Knoll wrote: > >> Hello, >> >> I am new to programming and to Python. I've been using Python with IDLE >> on Windows Vista for a few weeks now. >> (And I'm loving it!) However, I'm thinking about

Re: [Tutor] Refcount in C extensions

2011-01-14 Thread Izz ad-Din Ruhulessin
Hi Stefan, Thanks for your quick reply and clearing the issue up for me. Using your answer, I rewrote the function to this: double Py_GetAttr_DoubleFromFloat(PyObject *obj, const char *attr) > > { > > PyObject *get_attr, *py_float; > > int has_attr; > > >> //Check if the given object has the give

[Tutor] Refcount in C extensions

2011-01-14 Thread Izz ad-Din Ruhulessin
Hello, I am writing a Python C extension and I have some trouble understanding how reference counting works exactly. Though I think I understand the practice on simple operations (see my question at stackoverflow: http://stackoverflow.com/questions/4657764/py-incref-decref-when), but on more "comp