Re: best way to code

2008-12-20 Thread miya
On Dec 19, 2:35 pm, Peter Otten <[email protected]> wrote:
> eric wrote:
> > hi,
>
> > I need to find a "good" design pattern to instanciate, and add
> > specific code all in one. Let me explain it :
>
> > I need to define "some" code, better be in a class, something like
>
> > class LinkA(object):
> >     def mystuff(self):
> >          
>
> > class LinkB(object):
> >     def mystuff(self):
> >          
>
> > AND I need an instance of this class
> > { "stuff A": LinkA()
> >   "stuff B": LinkB()
> > }
>
> > This kind of code "would" be fine, I mean, the result effect in memory
> > is fine for me.
> > But I don't like the way I have to
> > 1/ give a useless name to LinkA, linkB (there can be hundreds of names
> > like that)
> > 2/ I have to write it down two times (and that's one time too much)
>
> > any ideas ?
>
> > something like
> > [
> > new object():
> >     def mystuff(self):
> >        
> > ,
> > new object():
> >     def mystuff(self):
> >        
> > ]
>
> > would be really perfect (but I know it does not work, or at least, I
> > don't know how to make it work)
>
> > In fact, I would like to define a class, and an instance in a single
> > statement
> >>> class Register:
>
> ...     def __init__(self):
> ...             self.items = []
> ...     def __call__(self, method):
> ...             class Link(object):
> ...                     mystuff = method
> ...             self.items.append(Link())
> ...>>> register = Register()
> >>> @register
>
> ... def mystuff(self): print "first"
> ...>>> @register
>
> ... def mystuff(self): print "second"
> ...>>> for item in register.items:
>
> ...     item.mystuff()
> ...
> first
> second
>
> Peter

Wow, loved this solution. Never thought about using decorators to
solve this kinda problems.

nice

-
Nicolás Miyasato (miya)
http://myPythonNotes.wordpress.com
http://nmiyasato.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: How to invoke the Python idle

2008-06-29 Thread miya
On Jun 29, 10:01 pm, Only-Trouble <[EMAIL PROTECTED]> wrote:
> Hi all
> I am running openSUSE 10.3
> I am learning python on my own, it seems like  the system has already
> installed a python IDLE
> The question is how to invoke it?
>
> Thanks
>
> Only-Trouble

how about executing from the terminal

idle

--
Nicolás Miyasato (miya)
http://nmiyasato.blogspot.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: python and web programming, easy way...?

2008-04-26 Thread miya
On Apr 26, 4:36 pm, bvidinli <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i use currently python for console programming.
> in past, i tried it for web programming, to use it instead of php.
> Unfortunately, i failed in my attempt to switch to python.
> Currently, i make many webbased programs and a "Easy Hosting Control
> Panel " (www.ehcp.net) that runs on php,
> ehcp is a hosting control panel in beta stage..
>
> in fact, i use python, love it and want to switch to it in my all
> projects, including webbased programs and ehcp.
> Can your recomment me the easiest, most usable way to use python in
> web programming..
>
> in past, in my first attemt... i was able to run python as  as apache
> cgi, runned it basicly,
> but i had many difficulties especially in sessions, cookies...
>
> maybe currently there is a solution, but i dont know.
>
> Please provide me the quickest/most appropriate solution for web
> programming in python.
> i will try to switch to python in ehcp too..
>
> Currently my web programs are simple Object Oriented programs, that
> basicly uses a few files, in php.
> i use sessions in use authentications.
> i currently use php because it is fairly easy to install/run on apache..
> you just put it on server, it runs.. i look something like this for
> python. because python programming is much better than php.
>
> Thank you a lot.
>
> --
> Ý.Bahattin Vidinli
> Elk-Elektronik Müh.
> ---
> iletisim bilgileri (Tercih sirasina gore):
> skype: bvidinli (sesli gorusme icin,www.skype.com)
> msn: [EMAIL PROTECTED]
> yahoo: bvidinli
>
> +90.532.7990607
> +90.505.5667711

Django is the way to go for web development.

http://www.djangoproject.com/

cya

--
Nicolás Miyasato ( miya )
--
http://mail.python.org/mailman/listinfo/python-list


SOAPpy and ArrayOfString

2008-08-14 Thread annu miya
Hi, 
 
In the article below you mention that you were succesful at doing this through 
perl. Would it be possible to send me the perl code?
 
http://mail.python.org/pipermail/python-list/2007-January/423311.html
 
Thank You
 
Regards
 
Sid


  --
http://mail.python.org/mailman/listinfo/python-list