Re: [Python-Dev] Dinamically set __call__ method
On Tue, Nov 4, 2014 at 7:15 PM, Roberto Martínez wrote: > > > On Tue, Nov 4, 2014 at 8:06 PM, Skip Montanaro > wrote: >> >> >> On Tue, Nov 4, 2014 at 1:01 PM, Roberto Martínez >> wrote: >>> >>> The workaround of calling a different method inside __call__ is not valid >>> for my case because I want to change the *signature* of the function also >>> -for introspection reasons. >> >> >> You could define __call__ like so: >> >> def __call__(self, *args, **kwds): >> self._my_call(*args, **kwds) > > > This was my first approach, but it is not very informative to the user and I > prefer to have arguments with descriptive names. We have to change __doc__ > too, so this is not an ideal solution for me. > > I tried to implement __getattribute__, but is not called either. :( I'd suggest starting a new thread on python-list (or stack overflow or whatever) explaining what the heck you're trying to do here and asking for higher-level advice/suggestions, because your current implementation strategy seems to have placed you on a path that is rapidly descending past "spaghetti" towards "tentacular". (Or alternatively I guess you could go all in: Iä! Iä! Metaclasses Fhtagn!) -n -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org -- https://mail.python.org/mailman/listinfo/python-list
Re: [Python-Dev] Python 2.x and 3.x use survey, 2014 edition
On 10 Dec 2014 17:16, "Ian Cordasco" wrote: > > On Wed, Dec 10, 2014 at 11:10 AM, Donald Stufft wrote: > > > > On Dec 10, 2014, at 11:59 AM, Bruno Cauet wrote: > > > > Hi all, > > Last year a survey was conducted on python 2 and 3 usage. > > Here is the 2014 edition, slightly updated (from 9 to 11 questions). > > It should not take you more than 1 minute to fill. I would be pleased if you > > took that time. > > > > Here's the url: http://goo.gl/forms/tDTcm8UzB3 > > I'll publish the results around the end of the year. > > > > Last year results: https://wiki.python.org/moin/2.x-vs-3.x-survey > > > > > > Just going to say http://d.stufft.io/image/0z1841112o0C is a hard question > > to answer, since most code I write is both. > > > > The same holds for me. That question appears to have just grown a "compatible with both" option. It might make sense to add a similar option to the following question about what you use for personal projects. -n -- https://mail.python.org/mailman/listinfo/python-list
Re: Query
> I want to make a binary file , which would execute on it's own. First do $ which python to get the location of your python binary. The default, i think, is just /usr/bin/python. Then add this line to the top of your file: #!/usr/bin/python (or whatever the `which` command returned) then finally do this command: $ chmod +x .py This makes executable ( that's what the x stands for ). now run it with: $ ./.py you can also trim the .py from the file and it will work just the same. To have your script work like installed binaries, put it in a folder in your PATH variable. For example, if you added the path /home//bin/ to your path variable ( PATH=$PATH:/home//bin/ ) Bash would search that directory when you typed in a command to execute. What this means is if you rename your .py to just and stick it in /home//bin/ you could just do $ at any time to run your program. hope my verbosity is helpful. -- -Nate -- http://mail.python.org/mailman/listinfo/python-list