[Tutor] Need a mentor

Shashwat Anand anand.shashwat at gmail.com
Mon Aug 9 12:08:24 CEST 2010


On Mon, Aug 9, 2010 at 3:28 PM, Steven D'Aprano <steve at pearwood.info> wrote:

> On Mon, 9 Aug 2010 07:21:03 pm Ranjith Kumar wrote:
> > On Mon, Aug 9, 2010 at 12:23 PM, Steven D'Aprano
> <steve at pearwood.info>wrote:
> > > On Mon, 9 Aug 2010 12:16:11 pm Ranjith Kumar wrote:
> > > > Hi all,
> > > >     I`m doing a python based project, I need a mentor who can
> > > > guide me and help me to complete the project.
> >
> > Sorry Mr. Steven I think u caught it wrong I`m not asking to trainee
> > me I almost completed this script
>

You need a mentor to help you :-/ . What is the problem is you work upon
your script and ask doubts here? You are confusing university projects with
real-life projects I think. In universities you choose a mentor and he help
you out. Here you work on your project, ask doubts and community help you
out. Isn't it good to have whole of the community helping you rather than
one single person.


>
> It's not clear exactly what you want. Lists like this work best when you
> ask *specific* questions like "how do I set a cookies from Python?"
> or "what's the difference between a list and a tuple?", not vague
> requests for a mentor.
>
> After reading both your posts, I'm still not entirely sure I understand
> what you want, but I'll try...
>
> [...]
> > After I complete this project I will send the code so any volunteers
> > can optimize the code so that we can provide better solution for open
> > source world and I will definitely upload this project under GPL
> > Licence in code.google.com and sourceforgue.net.
>
> It's not compulsory :)
>
> I don't understand why you think you need to optimize the code. Is it
> too slow?
>

I think he means that after his project is over, he will open-source the
code so that other's may improve upon it.


>
>
>
> [...]
> > These are the four things, I need to know is this
> > 1) Configuring window should runs automatically only first
> > time if the user wants to reconfigure the file again they should run
> > configuring module separately.
>
> That's a statement, not a question. What do you want to know?
>
> "Is this a good idea?"
>
> Depends on the application. Most applications give the user a
> Preferences or Settings menu so they can reconfigure the app at any
> time. But since I don't really know what your application does, I'm not
> sure if this is appropriate.
>
> "How do I do it?"
>
> The usual way is to have the application look for a configuration file
> in some place. If it is missing, then create a new one. If it is
> present, then read the file and use it as the config.
>
>
> > 2) This script is to start it automatically on every login and stay
> > running on background until i shut download the machine.
>
> Again, that's not a question, it's a statement. What do you want to
> know?
>
> "Is this a good idea?"
>
> Who knows? What does your program do?
>
> "How do I do it?"
>
> That depends. What operating system is your application supposed to run
> under?
>
>
>
>
> > 3) I need a best alternative way for switch case statement
>
> There is no "best alternative", it depends on the nature of the case
> statement you are replacing.
>
> If it is only a few cases, or if each test is a different sort of test:
>
> # pseudo-code
> case:
>  x == 1:
>    spam(arg)
>  x > 2:
>    ham(arg)
>  y/x < 0:
>    cheese(arg)
>  otherwise:
>    pickles(arg)
>
>
> the best alternative is a series of if...elif tests.
>
> If you have a series of simple equality comparisons, and you can write
> the case clause as a single function call:
>
>
> # pseudo-code
> case of x:
>  1:
>    spam(arg)
>  2:
>    ham(arg)
>  3:
>    cheese(arg)
>  otherwise:
>    pickles(arg)
>
>
> it is probably better re-writing it as a dispatch table:
>
> # python
> table = {1: spam, 2: ham, 3: cheese}
> func = table.get(x, pickles)
> func(arg)
>
>
> There are probably other alternatives that will be better depending on
> exactly what you are trying to do.
>
>
>
> > 4) Lastly I need to know is how to print the list of web browsers
> > installed on a machine.
>
> Printing it is easy: you print it the same way you print anything else:
> call print to output to the terminal, or generate a print job to send
> to a physical printer.
>
> The hard part is finding out what web browsers are installed on a
> machine. That's a hard problem, because there's no canonical list
> of "web browsers" for a computer.
>
> Take my machine, for example. I have:
>
> firefox 2.x
> firefox 3.x
> epiphany
> galeon
> konquorer
> links
> lynx
>
> and they're just the ones I know of. The problems are:
>
> * It is hard to tell what is a web browser and what isn't. If Adobe
> Acrobat lets you embed clickable links to http:// URLs in PDF files,
> does that make Acrobat a web browser? I suppose it does, but some
> people will say not. If Outlook displays web pages, is it a web
> browser? You can click on a link in a Word document, and Word will open
> that web page for you -- is it a browser?
>
> * Even if you decide exactly what is a web browser, there's no list of
> them anywhere. To find out which they are, you would need to start with
> a list of all the applications on the computer (what's an application?
> what if there are thousands of them?), and then somehow inspect each
> one and try to recognise whether or not it is a web browser or not.
> How?
>
> You probably can get the name of the *registered* web browser, but the
> way you do that will depend on the operating system and desktop
> environment. E.g. under Windows there is probably a registry setting
> that specifies which application to use as the default web browser. Or
> you can keep a list of possibilities, and search for them, ignoring
> anything else. Or you can ask the user. Or you can look at Python's
> webbrowser module and see what it does.
>
>
> So the answer will depend on why you want to print this list of web
> browsers, how accurate you want to be, and what system you are running
> under.
>
>
>
>
> --
> Steven D'Aprano
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
~l0nwlf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100809/19213a89/attachment.html>


More information about the Tutor mailing list