月忧茗 wrote:
> HI, I have some test code:
>
>
> def num(num):
> def deco(func):
> def wrap(*args, **kwargs):
> inputed_num = num
> return func(*args, **kwargs)
> return wrap
> return deco
>
>
> @num(5)
> def test(a):
> return a + inputed_num
>
In article ,
aza...@adconion.com wrote:
> Thanks for your response, I think the path is fine, since which python
> outputs the location where macports should install python i.e.
> /opt/local/bin/python.
>
> also
>
> port list active | fgrep python
> python27 @2.7.3
Hi Ned,
Thanks for your response, I think the path is fine, since which python outputs
the location where macports should install python i.e. /opt/local/bin/python.
also
port list active | fgrep python
python27 @2.7.3 lang/python27
and
port location python27
> i need to get an ip address from list of hostnames which are in a textfile.
>
> this is what i have so far
> --
> #!/usr/bin/env python
> #Get the IP Address
>
> import socket
> hostname = 'need it to read from a text file'
>
In article ,
azandi wrote:
> I installed python 2.7.3 using macports on Lion, and used port select python
> python27. However python version still shows 2.7.1.
>
> Any ideas why is that happenning? And how to fix it?
Macports installs its ports into a separate root. You need to ensure
that
On Wed, 12 Sep 2012 17:45:52 -0500
Tim Chase wrote:
> On 09/12/12 16:47, D'Arcy Cain wrote:
> > And run all of your tests every day. You will sleep better at night.
>
> Though I usually try to do test-driven development, I confess a
> fondness for Titus Brown's "Stupidity driven testing"[1] :-)
HI, I have some test code:
def num(num):
def deco(func):
def wrap(*args, **kwargs):
inputed_num = num
return func(*args, **kwargs)
return wrap
return deco
@num(5)
def test(a):
return a + inputed_num
print test(1)
when run this code, I got
On 9/12/2012 8:58 PM, Roy Smith wrote:
The atexit docs (http://docs.python.org/library/atexit.html) are very
confusing. In one place they say, "The order in which the functions are
called is not defined". In another place, "all functions registered are
called in last in, first out order". Whic
>>> I have a python script in which I have a list of files to input one by one
>>> and for each file I get a number as an output.
>>> I used for loop to submit the file to script.
>>> My script uses one file at a time and returns the output.
>>>
>>> My computers has 8 cores.
>>> Is there any way th
The atexit docs (http://docs.python.org/library/atexit.html) are very
confusing. In one place they say, "The order in which the functions are
called is not defined". In another place, "all functions registered are
called in last in, first out order". Which is correct?
Also, it's not clear ho
On 09/12/2012 12:56 PM, Jabba Laci wrote:
> Thanks for the answers. I decided to use numbers in the name of the
> functions to facilitate function calls. Now if you have this menu
> option for instance:
>
> (5) install mc
>
> You can type just "5" as user input and step_5() is called
> automaticall
On 09/12/2012 11:26 AM, janis.judvai...@gmail.com wrote:
> Hi, and I'm sorry for using this old thread, but I'm experiencing the same
> problem, except, that I wan't to execute any shell script or exe without
> blank terminal window.
> Is there any way in python to supress blank console screen w
I installed python 2.7.3 using macports on Lion, and used port select python
python27. However python version still shows 2.7.1.
Any ideas why is that happenning? And how to fix it?
Thanks in advance,
--
http://mail.python.org/mailman/listinfo/python-list
On 09/12/12 16:47, D'Arcy Cain wrote:
> On Wed, 12 Sep 2012 16:37:11 -0400
> Terry Reedy wrote:
>> assures one that the test is being run. (I don't always test first, but
>> I once discovered a test not being run when I modified it in a way that
>> should have made it fail, but it didn't.)
>
>
On Wed, 12 Sep 2012 18:04:51 GMT
Alister wrote:
> No No NO!
> you cant just pass user input to system calls without validating it first
> (google sql injection for examples of the damage unsanitised input can
> cause, it is not just as SQL problem)
http://xkcd.com/327/
--
D'Arcy J.M. Cain
On Wed, 12 Sep 2012 16:37:11 -0400
Terry Reedy wrote:
> assures one that the test is being run. (I don't always test first, but
> I once discovered a test not being run when I modified it in a way that
> should have made it fail, but it didn't.)
1. Write the test
2. Run the test - make sure it
On Wed, 12 Sep 2012 18:56:46 +0200
Jabba Laci wrote:
> (5) install mc
>
> You can type just "5" as user input and step_5() is called
> automatically. If I use descriptive names like install_java() then
> selecting a menu point would be more difficult. And I don't want users
> to type "java", I wa
On 12/09/2012 08:19, Dwight Hutto wrote:
The easiest solution is to:
1. Uninstall 64-bit Python
No need to do this, at least not on windows.
2. Install a 32-bit distribution.
in a separate directory. I have had both on my win7 machine so I could
run (test) python code on both. O
On 9/12/2012 10:41 AM, dkato...@gmail.com wrote:
it's not really homework, i found a lab exercise on the web
> and i;m trying to study with it. maybe not the most efficient way.
i have a file with hostnames ordered line by line.
Key fact for this exercise: open files are iterable.
So your
> You cannot synchronously set up a new TCP connection using a non-blocking >
> socket. Instead, you begin the connection attempt and it fails with
> EINPROGRESS and then you use epoll to find out when the attempt completes.
OK.
> I suggest reading the implementation of a Twisted reactor to see
On 9/12/2012 6:20 AM, andrea crotti wrote:
I wrote a decorator that takes a function, run it in a forked process
and return the PID:
This strikes me as an abuse of the decorator syntax.
@wrap
def f(): pass
is just syntactic sugar for
def f(): pass
f = wrap(f)
but that is not what you are do
On 9/12/2012 8:56 AM, Jabba Laci wrote:
This will call the 2nd function. Now my functions are called step_ID
(like step_27(), step_28(), etc.). How to avoid the danger of
redefinition? Now, when I write a new function, I search for its name
to see if it's unique but there must be a better way.
On Wednesday, September 12, 2012 12:01:58 PM UTC-4, Miki Tebeka wrote:
> Greetings,
>
> I'm trying to write a reverse TCP proxy using epoll (just for learning).
>
> I've started with the code at http://scotdoyle.com/python-epoll-howto.html
> and got to https://gist.github.com/3707665.
>
>
> How
Hi,
I am looking for a Java Python developer at NYC NY for one of our direct
client. It is a 6 Months contract position. We need a person with experience in
developing trading applications and very good with Python Development. If
interested, please send me your resume to my email address, ie
On 12/09/2012 19:04, Alister wrote:
On Wed, 12 Sep 2012 18:56:46 +0200, Jabba Laci wrote:
For example:
def install_java():
pass
def install_tomcat():
pass
Thanks for the answers. I decided to use numbers in the name of the
functions to facilitate function calls. Now if you have this m
On Wed, 12 Sep 2012 18:56:46 +0200, Jabba Laci wrote:
>> For example:
>>
>> def install_java():
>>pass
>>
>> def install_tomcat():
>>pass
>
> Thanks for the answers. I decided to use numbers in the name of the
> functions to facilitate function calls. Now if you have this menu option
> fo
On Wed, 12 Sep 2012 07:41:10 -0700, dkatorza wrote:
> בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com:
>> hello ,
>>
>>
>>
>> i'm new to Python and i searched the web and could not find an answer
>> for my issue.
>>
>>
>>
>> i need to get an ip address from list of ho
On 09/12/12 11:56, Jabba Laci wrote:
>> For example:
>>
>> def install_java():
>>pass
>>
>> def install_tomcat():
>>pass
>
> Thanks for the answers. I decided to use numbers in the name of the
> functions to facilitate function calls. Now if you have this menu
> option for instance:
>
> (
> Correct me if I'm wrong, but the reason for this absence is that people could
> think that doing repeated bisects using keys would be fast, even though keys
> has to be recomputed?
I think the main point Raymond had was:
If we added key= to bisect, it would encourage bad design and steer
On Wednesday, September 12, 2012 11:12:55 AM UTC-4, jelle wrote:
> You installed python 2.7 and expect a 2.6 module to work with it.
>
> That won't work. Finally, you need to install the OpenCasCade libs to be able
> to run PythonOCC.
>
>
>
> -jelle
I think that is the reason. Thanks a lot!!
> For example:
>
> def install_java():
>pass
>
> def install_tomcat():
>pass
Thanks for the answers. I decided to use numbers in the name of the
functions to facilitate function calls. Now if you have this menu
option for instance:
(5) install mc
You can type just "5" as user input and s
On Wednesday, September 12, 2012 4:23:49 PM UTC+1, (unknown) wrote:
> [...] David Goodger's "Code Like A Pythonista" in the "Naming" section [says
> single leading underscore is bad form].
> (http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#naming)
Looks like it says the opp
On Wed, Sep 12, 2012 at 9:23 AM, wrote:
>
> On Tuesday, September 11, 2012 5:02:31 PM UTC-5, Erik Max Francis wrote:
> > On 09/11/2012 01:53 PM, me wrote:
> > > PEP 8 says this is bad form. What do you think?
> >
> >
> >
> > Where does it say that?
>
> Apologies. It's in David Goodger's "Code Li
Il giorno mercoledì 12 settembre 2012 18:05:10 UTC+2, Miki Tebeka ha scritto:
> > I've just noticed that the bisect module lacks of the key parameter.
>
> > ...
>
> > Is there some reason behind this lack?
>
> See full discussion at http://bugs.python.org/issue4356. Guido said it's
> going in,
Hi,
Where do I find ArcPy.py?
It seems that the link disappeared.
Regards.
David--
http://mail.python.org/mailman/listinfo/python-list
Il giorno mercoledì 12 settembre 2012 17:54:31 UTC+2, Giacomo Alzetta ha
scritto:
> I've just noticed that the bisect module lacks of the key parameter.
>
>
>
> The documentation points to a recipe that could be used to handle a sorted
> collection, but I think it's an overkill if I want to bi
> I've just noticed that the bisect module lacks of the key parameter.
> ...
> Is there some reason behind this lack?
See full discussion at http://bugs.python.org/issue4356. Guido said it's going
in, however there's no time frame for it.
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
I'm trying to write a reverse TCP proxy using epoll (just for learning).
I've started with the code at http://scotdoyle.com/python-epoll-howto.html and
got to https://gist.github.com/3707665.
However, I can't create a new connection. When reaching line 34
(backend.connect), I get th
On 12/09/2012 14:51, Ken Seehart wrote:
Putting a few of peoples ideas together...
gt = lambda x: lambda y: x>y
eq = lambda x: lambda y: x==y
def constrain(c,d):
return all({f(x) for f, x in zip(c, d)})
If you're going to use 'all', why use a set?
return all(f(x) for f, x in zip(c,
I've just noticed that the bisect module lacks of the key parameter.
The documentation points to a recipe that could be used to handle a sorted
collection, but I think it's an overkill if I want to bisect my sequence only
once or twice with a key. Having something like `bisect(sequence, key=my_k
Hi, and I'm sorry for using this old thread, but I'm experiencing the same
problem, except, that I wan't to execute any shell script or exe without blank
terminal window.
Is there any way in python to supress blank console screen while script is
executing? Multiplatform solution would be nice.
On Tuesday, September 11, 2012 5:02:31 PM UTC-5, Erik Max Francis wrote:
> On 09/11/2012 01:53 PM, me wrote:
>
> > On Tuesday, September 11, 2012 2:06:45 PM UTC-5, Ian wrote:
>
> >> On Tue, Sep 11, 2012 at 12:45 PM, I wrote:
>
> >>> What is the significance of the leading underscore in "self._b
On Tue, Sep 11, 2012 at 11:10 PM, Dwight Hutto wrote:
> Not to jump in with another question(this seems somewhat relevant to the
> conversation, maybe not), but is this similar to a private,public, or
> protected class similar to the C type langs?
More like "this is an implementation detail and i
You installed python 2.7 and expect a 2.6 module to work with it.
That won't work. Finally, you need to install the OpenCasCade libs to be able
to run PythonOCC.
-jelle
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Sep 12, 2012 at 10:06 AM, wrote:
> ߒߤߒߡߜߦߡ ß ß§
And that's why you shouldn't let your kids play with your iPad :)
Dustin
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Sep 12, 2012 at 4:22 AM, pyjoshsys wrote:
> The output is still not what I want. Now runtime error free, however the
> output is not what I desire.
[SNIP]
> class Trial(object):
> '''class to demonstrate with'''
> def __init__(self):
> object.__init__(self)
> sel
בתאריך יום רביעי, 12 בספטמבר 2012 17:24:50 UTC+3, מאת dkat...@gmail.com:
> hello ,
>
>
>
> i'm new to Python and i searched the web and could not find an answer for my
> issue.
>
>
>
> i need to get an ip address from list of hostnames which are in a textfile.
>
>
>
> this is what i have
On Thu, Sep 13, 2012 at 12:24 AM, wrote:
> i'm new to Python and i searched the web and could not find an answer for my
> issue.
>
> i need to get an ip address from list of hostnames which are in a textfile.
This is sounding like homework, so I'll just give you a basic pointer.
You have there
On 12/09/2012 14:51, Ken Seehart wrote:
[snip]
Could you please not top post on this list, thanks.
--
Cheers.
Mark Lawrence.
--
http://mail.python.org/mailman/listinfo/python-list
hello ,
i'm new to Python and i searched the web and could not find an answer for my
issue.
i need to get an ip address from list of hostnames which are in a textfile.
this is what i have so far
--
#!/usr/bin/env python
#G
On 09/12/2012 06:56 AM, Jabba Laci wrote:
> I have an installer script that contains lots of little functions. It
> has an interactive menu and the corresponding function is called. Over
> time it grew long and when I want to add a new function, I should give
> a unique name to that function. Howev
ߒߤߒߡߜߦߡ ߠߧ
-Original Message-
From: "Christophe de Vienne"
Sent: Thu, 06 Sep 2012 15:15:23 +0200
To: python-annou...@python.org
Subject: odt2sphinx 0.2.3 released
Hello,
odt2sphinx 0.2.3 is now available on pypi :
http://pypi.python.org/pypi/odt2sphinx/.
Odt2sphinx convert OpenDocume
On Wed, 12 Sep 2012 06:15:21 -0700, Ramchandra Apte wrote:
> On Wednesday, 12 September 2012 18:26:36 UTC+5:30, Jabba Laci wrote:
>> Hi,
>>
>>
>>
>> I have an installer script that contains lots of little functions. It
>>
>> has an interactive menu and the corresponding function is called. Ov
On Wed, 12 Sep 2012 14:56:12 +0200
Jabba Laci wrote:
> This will call the 2nd function. Now my functions are called step_ID
> (like step_27(), step_28(), etc.). How to avoid the danger of
> redefinition? Now, when I write a new function, I search for its name
> to see if it's unique but there must
Putting a few of peoples ideas together...
gt = lambda x: lambda y: x>y
eq = lambda x: lambda y: x==y
def constrain(c,d):
return all({f(x) for f, x in zip(c, d)})
constraints = [gt(2), eq(1)]
data0 = [1,1]
data1 = [3,1]
print constrain(constraints, data0)
print constrain(constraints, da
On 12 September 2012 14:25, Libra wrote:
> On Wednesday, September 12, 2012 3:11:42 PM UTC+2, Steven D'Aprano wrote:
> > On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote:
>
> > > I need to implement a function that returns 1 only if all the values in
> > > a list satisfy given constraints (at leas
Libra writes:
> On Wednesday, September 12, 2012 3:02:44 PM UTC+2, Jussi Piitulainen wrote:
>
> > So you would associate each constraint with an index. You could
> > maintain a list of constraints and apply it to the values as
> > follows:
>
> Yes, even though there could be more constraints for
On Wednesday, September 12, 2012 3:19:28 PM UTC+2, Libra wrote:
> > {False, True}
> Actually, I don't understand the output. Why it is both False and True?
Ok, I have understood now, I didn't noticed it was a set and not a list.
Regards
--
http://mail.python.org/mailman/listinfo/python-list
Use lambda expressions to define some constraints:
gt = lambda x: lambda y: x>y
eq = lambda x: lambda y: x==y
constraints = [gt(2), eq(1)]
data = [3,1]
for i,c in enumerate(constraints):
print c(data[i])
On 9/12/2012 5:56 AM, Jabba Laci wrote:
> Hi,
>
> I have an installer script t
On Wednesday, September 12, 2012 3:11:42 PM UTC+2, Steven D'Aprano wrote:
> On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote:
> > I need to implement a function that returns 1 only if all the values in
> > a list satisfy given constraints (at least one constraint for each
> > element in the list),
On Wednesday, September 12, 2012 3:02:44 PM UTC+2, Jussi Piitulainen wrote:
> So you would associate each constraint with an index. You could
> maintain a list of constraints and apply it to the values as follows:
Yes, even though there could be more constraints for each value in the list (at
l
On 09/12/12 08:02, Jussi Piitulainen wrote:
> Libra writes:
>> For example, I may have a list L = [1, 2, 3, 4] and the following
>> constraints:
>> L[0] >= 1
>> L[1] <= 3
>> L[2] == 2
>> L[3] >= 3
>
> So you would associate each constraint with an index. You could
> maintain a list of constraints
On Wednesday, 12 September 2012 18:26:36 UTC+5:30, Jabba Laci wrote:
> Hi,
>
>
>
> I have an installer script that contains lots of little functions. It
>
> has an interactive menu and the corresponding function is called. Over
>
> time it grew long and when I want to add a new function, I sh
On Wed, 12 Sep 2012 05:48:09 -0700, Libra wrote:
> Hello,
>
> I need to implement a function that returns 1 only if all the values in
> a list satisfy given constraints (at least one constraint for each
> element in the list), and zero otherwise.
What are the restrictions on the constraints them
Libra writes:
> Hello,
>
> I need to implement a function that returns 1 only if all the values
> in a list satisfy given constraints (at least one constraint for
> each element in the list), and zero otherwise.
>
> For example, I may have a list L = [1, 2, 3, 4] and the following
> constraints:
Hi,
I have an installer script that contains lots of little functions. It
has an interactive menu and the corresponding function is called. Over
time it grew long and when I want to add a new function, I should give
a unique name to that function. However, Python allows the
redefinition of functio
Hello,
I need to implement a function that returns 1 only if all the values in a list
satisfy given constraints (at least one constraint for each element in the
list), and zero otherwise.
For example, I may have a list L = [1, 2, 3, 4] and the following constraints:
L[0] >= 1
L[1] <= 3
L[2] ==
John Nagle writes:
>I want to parse standard ISO date/time strings such as
>
> 2012-09-09T18:00:00-07:00
>
> into Python "datetime" objects.
Consider whether RFC 3339 might be a more suitable format.
It is a subset of ISO 8601 extended format. Some of the restrictions are
Year mus
[ Ramchandra Apte wrote on Tue 11.Sep'12 at 19:58:29 -0700 ]
> On Tuesday, 11 September 2012 22:19:08 UTC+5:30, Charles Hottel wrote:
> > I have a lot of programming experience in many different languages and now
> >
> > I want to learn Python. Which version do you suggest I download, Python
On Wed, Sep 12, 2012 at 3:50 PM, andrea crotti
wrote:
> I wrote a decorator that takes a function, run it in a forked process
> and return the PID:
>
> def on_forked_process(func):
> from os import fork
> """Decorator that forks the process, runs the function and gives
> back control t
On Wed, Sep 12, 2012 at 6:58 AM, Diabolic Preacher wrote:
> I really hoped for at least one mention of Python in there.
It does seem like a blanketed letter to several groups, but maybe
they're looking for any good programmer.
Once you learn a language, and in my opinion learn to algorithm, then
Looks to me like someone recruiting experienced programmers, and there
is a demographic here who would probably like a job like that.
Definitely not considered SPAM by me. They're not selling, they're
trying to gainfully employ a good programmer from a list meant to
interact and learn.
If I had e
so decorators only pass the object and not any instance of the object as the
implied argument? Is this right?
The idea was to use @setname instead of instance.SetName(instance.__name__).
I thought decorators would do this, but it seems not.
--
http://mail.python.org/mailman/listinfo/pyth
I really hoped for at least one mention of Python in there. Like
'knows how to use it to calculate numbers'. anything.
Does GMail learn from Google Groups' spam reporting?
Thanks
>
>> Please explain what does this have to do with Python.
--
Diabolic Preacher
As Is
Blog: http://abusiveviews.w
On 09/12/12 00:10, Dwight Hutto wrote:
> Not to jump in with another question(this seems somewhat relevant
> to the conversation, maybe not), but is this similar to a
> private,public, or protected class similar to the C type langs?
Close, but C-like languages tend to strictly enforce it, while in
On Wed, 12 Sep 2012 03:22:31 -0700 (PDT), pyjoshsys
wrote:
The output is still not what I want. Now runtime error free,
however the output is not what I desire.
def setname(cls):
'''this is the proposed generator to call SetName on the
object'''
try:
cls.SetName(cls.__name
The output is still not what I want. Now runtime error free, however the output
is not what I desire.
def setname(cls):
'''this is the proposed generator to call SetName on the object'''
try:
cls.SetName(cls.__name__)
except Exception as e:
print e
finally:
On 12/09/2012, Chris Angelico wrote:
> On Wed, Sep 12, 2012 at 11:38 AM, Joshua Landau
> wrote:
>> On 12 September 2012 02:14, Steven D'Aprano
>> wrote:
>>>
>>> On Wed, 12 Sep 2012 08:52:10 +1000, Chris Angelico wrote:
>>>
>>> > Inline functions? I like this idea. I tend to want them in pretty m
On Wednesday, 12 September 2012 14:11:56 UTC+5:30, Ramchandra Apte wrote:
> On Wednesday, 12 September 2012 14:04:56 UTC+5:30, alex23 wrote:
>
> > On 12 Sep, 16:31, Mark Lawrence wrote:
>
> >
>
> > > Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html
>
> >
>
> > > Ther
On Wednesday, 12 September 2012 14:04:56 UTC+5:30, alex23 wrote:
> On 12 Sep, 16:31, Mark Lawrence wrote:
>
> > Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html
>
> > There is no longer an equivalent document for the Python 1.x or 2.x
>
> > series of releases.
>
>
>
>
On 12 Sep, 16:31, Mark Lawrence wrote:
> Perhaps this will sway youhttp://docs.python.org/dev/whatsnew/3.3.html
> There is no longer an equivalent document for the Python 1.x or 2.x
> series of releases.
Perhaps not for 1.x but the 2.x series is still covered:
http://docs.python.org/dev/whatsnew/
On Wed, Sep 12, 2012 at 3:37 AM, Mark Lawrence wrote:
> On 12/09/2012 08:19, Dwight Hutto wrote:
>>
>> So used to google, forgot to check the python docs:
>>
>> http://docs.python.org/faq/windows.html
>>
>> and this should be useful as well, which is from:
>>
>> http://stackoverflow.com/questions/
On 12/09/2012 08:19, Dwight Hutto wrote:
So used to google, forgot to check the python docs:
http://docs.python.org/faq/windows.html
and this should be useful as well, which is from:
http://stackoverflow.com/questions/5030362/how-to-use-opencv-in-python
"I suspect you have the same problem
So used to google, forgot to check the python docs:
http://docs.python.org/faq/windows.html
and this should be useful as well, which is from:
http://stackoverflow.com/questions/5030362/how-to-use-opencv-in-python
"I suspect you have the same problem I've run into. If you have a 64-bit
version
84 matches
Mail list logo