imho wrote:
> Hi all.
>
> Is there a way to know if a function object is actually a "generator
> function" or not ? e.g.:
>
> def f():
> pass
>
> def g():
> yield None
>
> f.__class__ is the same as g.__class__ , i.e. "function" type.
> But i "know" that the second, when invoked, r
Dan Stromberg wrote:
> I've been a sysadmin for about 13 years, but I'm realizing that my
> favorite part of being a sysadmin are those moments where there's a reason
> to write some code - preferably in python.
>
> What might one do to make the transition from sysadmin to python
> programmer, asi
Georg Brandl ha scritto:
f.func_code.co_flags
> 67
g.func_code.co_flags
> 99
>
> => 32 (CO_GENERATOR in compiler.consts) is the flag that indicates a
> generator code object.
>
> Georg
What a fast reply!
Thank You very much! :-)
--
http://mail.python.org/mailman/listinfo/python-list
I'm got a script which has a function with a while 1: loop that seems to execute the line it's doing twice instead of just once on each pass when called in a thread...#Script Startimport threading,time,cherrypy
def func(): while 1: print time.ctime() time.sleep(30)threading._start_
Hi,
following is the python scripts:
import marshal
script = """
print 'hello'
"""
code = compile(script, "
Steve Holden wrote:
> [EMAIL PROTECTED] wrote:
> > I have a problem. I'm writing a simulation program with a number of
> > mechanical components represented as objects. When I create instances
> > of objects, I need to reference (link) each object to the objects
> > upstream and downstream of it,
Michael J. Fromberger wrote:
...
>
> Of course, I could just bypass super, and explicitly invoke them as:
>
> C.__init__(self, ...)
> D.__init__(self, ...)
>
> ... but that seems to me to defeat the purpose of having super in the
> first place.
As others have pointed out, super, is designe
Dan Stromberg wrote:
> I've been a sysadmin for about 13 years, but I'm realizing that my
> favorite part of being a sysadmin are those moments where there's a reason
> to write some code - preferably in python.
>
> What might one do to make the transition from sysadmin to python
> programmer, asid
Hi,
I saw the rexec module is deprecated. I need to develop a python
application able to run custom python code based on a configuration
file that tells the path of the script that have to be executed. Those
scripts can be runned simultaneously trought threading module, but the
MUST not have any w
I have a WxPython app that displays images that are typically around
600x600 pixels. I use a wxStaticBitmap, which appears to work fine on
Windows XP. However the documentation states that a StaticBitmap "...
is meant for display of the small icons in the dialog boxes and is not
meant to be a gener
"Gabriele *darkbard* Farina" <[EMAIL PROTECTED]> writes:
> There is a way to reach this point without using rexec?
Not without a totally separate interpreter. If rexec were so easy
to fix, they'd fix it.
> There is a way to start a python interpreter from python to run the
> scripts?
Of course
Hi, all,
i mean to convert
'c\000\000\000\000\001\000\000\000s\017\000\000\00
> 0\177\000\000\177\002\000d\000\000GHd\001\000S(\00
> 2\000\000\000s\005\000\000\000helloN(\000\000\000\
> 000(\000\000\000\000s\010\000\000\000
Using a separate interpreter could be a solution, but restarting any
time the interpreter give me too much overhead and the application will
work as slow as a CGI app even if it runs using FastCGI.
Can't I put the interpreter to the starting state any time it finishes
a script execution without re
"Gabriele *darkbard* Farina" <[EMAIL PROTECTED]> writes:
> Using a separate interpreter could be a solution, but restarting any
> time the interpreter give me too much overhead and the application will
> work as slow as a CGI app even if it runs using FastCGI.
How many users are you talking about?
[EMAIL PROTECTED] wrote:
> Hey there,
> i have been learning python for the past few months, but i can seem to
> get what exactly a lamda is for. What would i use a lamda for that i
> could not or would not use a def for ? Is there a notable difference ?
> I only ask because i see it in code sample
In article <[EMAIL PROTECTED]>,
Michael Spencer <[EMAIL PROTECTED]> wrote:
> As others have pointed out, super, is designed to do something different from
> what you want. See
> http://www.python.org/download/releases/2.2.3/descrintro/#cooperation for
> GvR's
> explanation of super's inten
Greetings.
In an effort to get python2.4 on my Centos 3.7, I installed the python
bootstrap rpm. This installed 2.4 alongside 2.2 and updated yum to 2.4.0.
Oddly, it didn't create a symlink 'python' for either 2.2 or 2.4. I also
get a series of troubling dependency errors when I run yum updat
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746
When you think of modifying the interpreter, think of the compiler
module.
Gabriele *darkbard* Farina wrote:
> Hi,
>
> I saw the rexec module is deprecated. I need to develop a python
> application able to run custom python code based
Bruno Desthuilliers wrote:
> danielx wrote:
> > At first I was going to post the following:
> >
> >
> >
> (snip)
> >
> >
> >
> > but then I tried this:
> >
> >
> res = Foo.__dict__['func']
> res is dan
> >
> > True
> >
> > And it all started to make sense. The surprising thing turned out
Leif K-Brooks wrote:
> danielx wrote:
> > This is still a little bit of magic, which gets me thinking again about
> > the stuff I self-censored. Since the dot syntax does something special
> > and unexpected in my case, why not use some more dot-magic to implement
> > privates? Privates don't have
Duncan Booth wrote:
> danielx wrote:
>
> Foo.func = dan# <-- Appearantly, something magical happens here,
> because...
> Foo.func
> >
> f = Foo.func
> f is dan # <-- things begins to look suprising here.
> > False
> ismethod(f)
> > True
> >
> > Imagine my
Hi all
I am attempting to understand threads to use in a network app which I
am writing. The part that I am going to use threads on is run on the
clients/workstations. I will monitor all starting and ending
processes. Below is what I have been doing. It looks like only the
first thread is starti
PyPgExplorer is a pure python application that allows the
user to browse and modify Postgresql Databases. Features
include:
o A Scripts menu that makes access to your favorite SQL
scripts only a click away.
o On unix and Mac systems, if psql is detected in a
standard location, then access to
Grant Edwards wrote:
> If the server has closed the connection, then a recv() on the
> socket will return an empty string "",
after returning all the data the remote side had sent, of course.
> and a send() on the
> socket will raise an exception.
Send() might, and in many cases should, raise a
A newbie to Tkinter here. . . . . .
I'm trying to set the focus on an Entry textbox with
focus_set. I am using the grid manager. I created the same
interface before using the pack() method and the focus_set
worked, but now it says
"AttributeError: 'NoneType' object has no attribute 'focus_s
Bruno Desthuilliers wrote:
> ZeD wrote:
> > Bruno Desthuilliers wrote:
> >
> >
> >>>I decided to change the name of an attribute. Problem is I've used the
> >>>attribute in several places spanning thousands of lines of code. If I
> >>>had encapsulated the attribute via an accessor, I wouldn't need
On Thu, 2006-07-20 at 02:53 +, Stan Cook wrote:
> A newbie to Tkinter here. . . . . .
>
> I'm trying to set the focus on an Entry textbox with
> focus_set. I am using the grid manager. I created the same
> interface before using the pack() method and the focus_set
> worked, but now it sa
[EMAIL PROTECTED] wrote:
> I have a problem. I'm writing a simulation program with a number of
> mechanical components represented as objects.
Have you looked at SimPy? This may simplify much of your data
structure anguish (probably only need forward refs, without the back
refs), plus it will do
Carl Banks ha scritto:
> Pupeno wrote:
> > I see, thank you.
> >
> > class MyConfig(ConfigParser, object):
> > def add_section(self, section)
> > super(MyConfig, self).add_section(section)
> >
> > seems to work and as expected. Is there anything wrong with it ?
>
> Wow.
>
> I highly r
hello. i'm using wxPython as my GUI package and whenever my program
executes a long process which takes at least 2 or 3 seconds, the user
interface gets corrupted while executing the progrocess during the
period.
i have tried the following lines of code...
frame = mainwindow(None, -1, 'my program
Sanjay ha scritto:
> Thanks for the code showing how to implement partial classes. Infact, I
> was searching for this code pattern. I will have a study on metaclass
> and then try it.
>
> Thanks
> Sanjay
Anyway, I would suggest you NOT to use this code in production. Yes,
Python
can imitate Ruby
Terry Reedy wrote:
>
> > Carl Banks wrote:
> >> def process_values(lst):
> >> if not lst:
> >> return
> >> do_expensive_initialization_step()
> >> for item in lst:
> >> do_something_with(item)
> >> do_expensive_finalization_step()
>
> Give
Bruno Desthuilliers wrote:
> mystilleef wrote:
> > Bruno Desthuilliers wrote:
> >
> >>mystilleef wrote:
> (snip)
> >
> >Of course using setters for the sake of just using them is pointless.
>
> Indeed.
>
>
>
> >The reason to use them is if pre-conditions or post
Patch / Bug Summary
___
Patches : 398 open ( +5) / 3334 closed (+19) / 3732 total (+24)
Bugs: 904 open ( -4) / 6011 closed (+36) / 6915 total (+32)
RFE : 222 open ( -1) / 231 closed ( +2) / 453 total ( +1)
New / Reopened Patches
__
Fix for #
Michele Simionato ha scritto:
> I believe the new style system was designed to allows this sort of
> mixing and
> that there are no issues at all.
Thinking a bit more, there are no issues at all if you know what a new
style class is and if you do not expect it to work as an old-style one
;) For th
> Anyway, I would suggest you NOT to use this code in production. Yes,
> Python
> can imitate Ruby, but using this kind of classes would confuse
> everybody and
> make your code extremely unpythonic. As always, consider changing your
> mindset,
> when you switch language. For you problem, you could
Steve Holden wrote:
> mystilleef wrote, making me somewhat tired of his/her repeated inability
> to get what's being said [sigh]:
> > Bruno Desthuilliers wrote:
> >>mystilleef wrote:
> >>>Bruno Desthuilliers wrote:
> mystilleef wrote:
> >Gerhard Fiedler wrote:
> >>On 2006-07-15 06:55:1
In message <[EMAIL PROTECTED]>, Georg Brandl wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, Bob Greschke
>> wrote:
>>
>>> I'd go even one step further. Turn it into English (or your favorite
>>> non-computer language):
>>>
>>> 1. While list, pop.
>>>
>>> 2. While the le
Kay Schluehr wrote:
> What about letting your teammates editing certain data-structures in
> different files ( physical modules ) but using them in a uniform way
> and enable a single access point. If you have partial classes there is
> no reason why your team has to share a large file where they h
damacy wrote:
> hello. i'm using wxPython as my GUI package and whenever my program
> executes a long process which takes at least 2 or 3 seconds, the user
> interface gets corrupted while executing the progrocess during the
> period.
>
> i have tried the following lines of code...
>
> frame = mai
Gabriele *darkbard* Farina wrote:
> The first attempt to reach my goal was to override the __import__
> function to limit it working on modules that can be used and on custom
> import directories that can be accessed. Then I executed the scripts
> using exec. There is any security problem related t
Hi All
Can any one help me out with the various depricated string functions
that is followed in Python.
For example how will be string.lower depricated.
As far as string.lower('PYTHON') is concerned it is depricated as
'PYTHON'.lower(). Both of them would return an output : >>> python
Thanks fo
Anoop wrote:
> Can any one help me out with the various depricated string functions
> that is followed in Python.
>
> For example how will be string.lower depricated.
>
> As far as string.lower('PYTHON') is concerned it is depricated as
> 'PYTHON'.lower(). Both of them would return an output : >>
John Machin wrote:
> On 20/07/2006 6:05 AM, John Machin wrote:
> > On 20/07/2006 1:58 AM, [EMAIL PROTECTED] wrote:
> >> def is_prime n:
> >
> > Syntax error. Should be:
> >def is_prime n:
>
> Whoops! Take 2:
>
> Should be:
>
> def is_prime(n):
Sorry for that, I was not able to cut-paste the c
Dave,
Python properties allow you to get rid of methods like c.getAttr(),
c.setAttr(v), c.delAttr() and replace them with simple constructs like
c.attr, c.attr=v and del c.attr.
If you have been using Java or C++ you know that as soon as you code
your class you have to start filling in the get()
Dennis Lee Bieber wrote:
> On 19 Jul 2006 19:08:12 -0700, "gel" <[EMAIL PROTECTED]> declaimed the
> following in comp.lang.python:
>
> > import thread
> >
> Step one... Skip the thread module and use threading module instead.
>
> > def create():
> >
> > pythoncom.CoInitialize()
> >
In <[EMAIL PROTECTED]>, mystilleef
wrote:
>
> Bruno Desthuilliers wrote:
>> mystilleef wrote:
>> > Bruno Desthuilliers wrote:
>> >
>> > Because you don't want third parties illegimately tampering with an
>> > object's internal data and thus crashing your system?
>>
>> Let's try again...
>>
>> poi
201 - 247 of 247 matches
Mail list logo