On Tue, 18 Oct 2022 at 03:51, Stefan Ram wrote:
>
> MRAB writes:
> >It can't optimise that because, say, 'print' could've been bound to a
> >function that rebinds 'str'.
>
> It would be possible to find out whether a call of a function
> named "print" is to the standard function, but the over
On 2022-10-17 16:43, David Lowry-Duda wrote:
One can use the `dis` module and investigate the generated python
bytecode. For me, I get
# file "dis1.py"
thing = 123
for i in range(10):
if "hi" == str(thing):
print("found")
break
The bytecode is then
1 0 L
One can use the `dis` module and investigate the generated python
bytecode. For me, I get
# file "dis1.py"
thing = 123
for i in range(10):
if "hi" == str(thing):
print("found")
break
The bytecode is then
1 0 LOAD_CONST 0 (123)
2 STORE
On 10/14/22 16:25, DFS wrote:
> -
> this does a str() conversion in the loop
> -
> for i in range(cells.count()):
>if text == str(ID):
> break
>
>
> ---
-
this does a str() conversion in the loop
-
for i in range(cells.count()):
if text == str(ID):
break
On 18 June 2018 at 22:18, Etienne Robillard wrote:
> Hi,
>
> Quick question: Does anyone of you know what is the effect of enabling
> gc.enable() in sitecustomize.py when using PyPy? Can it reduce latency for
> long-lived WSGI applications?
>
gc is enabled by default. yo
Le 2018-06-18 à 22:47, William ML Leslie a écrit :
On 18 June 2018 at 22:18, Etienne Robillard wrote:
Hi,
Quick question: Does anyone of you know what is the effect of enabling
gc.enable() in sitecustomize.py when using PyPy? Can it reduce latency for
long-lived WSGI applications?
gc is
Hi,
Quick question: Does anyone of you know what is the effect of enabling
gc.enable() in sitecustomize.py when using PyPy? Can it reduce latency
for long-lived WSGI applications?
Thanks,
Etienne
--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/
--
https
On Oct 27, 2017 5:38 PM, "Ian Kelly" wrote:
In addition to what others have answered, if the code in question has any
variables then I'll prefer to put it inside a function and call the
function. This ensures that the variables are local and not going. It's a
minor code hygiene point, but a good
In addition to what others have answered, if the code in question has any
variables then I'll prefer to put it inside a function and call the
function. This ensures that the variables are local and not going. It's a
minor code hygiene point, but a good practice in my opinion.
--
https://mail.pytho
On 10/27/17 2:05 PM, ROGER GRAYDON CHRISTMAN wrote:
While teaching my introductory course in Python, I occasionally see
submissions containing the following two program lines, even before
I teach about functions and modules:
if __name__ = '__main__':
... main()
When I ask about it, I hear thin
On 2017-10-27, Chris Angelico wrote:
> On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote:
>> While teaching my introductory course in Python, I occasionally see
>> submissions containing the following two program lines,[...]
>> if __name__ = '__main__':
>> ... main()
> If it's JUS
On 27/10/17 20:05, ROGER GRAYDON CHRISTMAN wrote:
> While teaching my introductory course in Python, I occasionally see
> submissions containing the following two program lines, even before
> I teach about functions and modules:
>
> if __name__ = '__main__':
> ... main()
>
> When I ask about it,
On Sat, Oct 28, 2017 at 5:23 AM, Chris Angelico wrote:
> On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote:
>> While teaching my introductory course in Python, I occasionally see
>> submissions containing the following two program lines, even before
>> I teach about functions and mod
On Sat, Oct 28, 2017 at 5:05 AM, ROGER GRAYDON CHRISTMAN wrote:
> While teaching my introductory course in Python, I occasionally see
> submissions containing the following two program lines, even before
> I teach about functions and modules:
>
> if __name__ = '__main__':
> ... main()
>
> When I
While teaching my introductory course in Python, I occasionally see
submissions containing the following two program lines, even before
I teach about functions and modules:
if __name__ = '__main__':
... main()
When I ask about it, I hear things like they got these from other instructors,
or from
In John Kelly
writes:
> I received Python with another install and my update software keeps
> signaling I need to install a newer version, and once I do, the older
> version is still there, so I keep getting told I need to update. Should
> I be able to uninstall the old version each time?
Yes,
On 3/31/15 10:09 AM, John Kelly wrote:
Pythonites,
I received Python with another install and my update software keeps
signaling I need to install a newer version, and once I do, the older
version is still there, so I keep getting told I need to update. Should
I be able to uninstall the old vers
Pythonites,
I received Python with another install and my update software keeps signaling I
need to install a newer version, and once I do, the older version is still
there, so I keep getting told I need to update. Should I be able to uninstall
the old version each time?
Thanks for your kind att
On 19/10/2014 21:18, Ryan Shuell wrote:
Ok, thanks everyone. I just need to spend more time with this stuff.
It's definitely slow going.
Please don't top post on this list, thank you.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
M
Ok, thanks everyone. I just need to spend more time with this stuff. It's
definitely slow going.
On Sat, Oct 18, 2014 at 11:16 PM, Rustom Mody wrote:
> On Sunday, October 19, 2014 8:25:53 AM UTC+5:30, Ben Finney wrote:
> > Chris Angelico writes:
>
> > > Try learning Python itself, rather than
On Sunday, October 19, 2014 8:25:53 AM UTC+5:30, Ben Finney wrote:
> Chris Angelico writes:
> > Try learning Python itself, rather than playing around with extension
> > packages like pytz.
> To be fair, "You need to install 'pytz' to work correctly with date and
> time values" is correct advice.
On Sun, Oct 19, 2014 at 1:54 PM, Ben Finney wrote:
> Chris Angelico writes:
>
>> Try learning Python itself, rather than playing around with extension
>> packages like pytz.
>
> To be fair, “You need to install ‘pytz’ to work correctly with date and
> time values” is correct advice. If the OP doe
Chris Angelico writes:
> Try learning Python itself, rather than playing around with extension
> packages like pytz.
To be fair, “You need to install ‘pytz’ to work correctly with date and
time values” is correct advice. If the OP doesn't install it early, then
works with timestamps, problems ar
ryguy7272 writes:
> So, when I run it, the setup.py text file opens. Nothing runs; nothing
> installs.
You have somehow (either manually, or by answering a question to some
program) associated the ‘.py’ suffix with “Open this file in my text
editor”.
That's fine, but it means that if you don't
On Sun, Oct 19, 2014 at 1:44 PM, ryguy7272 wrote:
> I'll probably give it until the end of the year, and start learning Chinese.
> There's other things I want to do with my time. I know 10 programming
> languages. I thought it would be fun to learn Python, but after 2 months, I
> still can't
On Saturday, October 18, 2014 3:55:02 PM UTC-4, ryguy7272 wrote:
> I downloaded PYTZ and put it here.
>
> C:\Python27\pytz
>
>
>
> Now, in the cmd window, I typed this:
>
> C:\Python27\pytz\setup.py
>
>
>
> A text file opens and nothing else happens. I thought it was supposed to
> install
On 18/10/2014 20:54, ryguy7272 wrote:
I downloaded PYTZ and put it here.
C:\Python27\pytz
Now, in the cmd window, I typed this:
C:\Python27\pytz\setup.py
A text file opens and nothing else happens. I thought it was supposed to
install the PYTZ library.
What am I doing wrong?
You will end
On Sat, Oct 18, 2014 at 3:54 PM, ryguy7272 wrote:
> I downloaded PYTZ and put it here.
> C:\Python27\pytz
>
> Now, in the cmd window, I typed this:
> C:\Python27\pytz\setup.py
>
> A text file opens and nothing else happens. I thought it was supposed to
> install the PYTZ library.
>
> What am I d
I downloaded PYTZ and put it here.
C:\Python27\pytz
Now, in the cmd window, I typed this:
C:\Python27\pytz\setup.py
A text file opens and nothing else happens. I thought it was supposed to
install the PYTZ library.
What am I doing wrong?
--
https://mail.python.org/mailman/listinfo/python-li
Hi All
We have a windows application to install on console mode typing on
cygwin shell "app.exe -i console"
On Windows process window, we could see this kicks a process named ia
which in turn kicks off ia_launcher to kick off another java.exe
process.
ie
app.exe -- kick off --> ia --> kicks off -
On 12/27/2011 05:26 PM, Littlefield, Tyler wrote:
Hello all:
I have a basic server I am working on, and wanted some input with an
error I'm getting.
I am initializing the logger like so:
if __name__ == "__main__":
observer = log.PythonLoggingObserver()
observer.start()
logging.basicConfig(filenam
Hello all:
I have a basic server I am working on, and wanted some input with an
error I'm getting.
I am initializing the logger like so:
if __name__ == "__main__":
observer = log.PythonLoggingObserver()
observer.start()
logging.basicConfig(filename='logs/server.log', level=logging.DEBUG,
On Mon, Aug 1, 2011 at 6:04 AM, Ira Gray wrote:
> I come along, write a .DLL and throw it into the program. My .dll has its
> own thread (right?),
Not unless you actually create one. A DLL is simply a puddle of code;
the application calls your code, you do whatever you do, you return.
At no time
Lets say I have a program that is running a python interpreter in the main
thread.
I come along, write a .DLL and throw it into the program. My .dll has its
own thread (right?), separate from the main thread, and then makes a
pyrun_simplestring call to the pythonxx.dll. The pyrun_simplestring call
[EMAIL PROTECTED] wrote:
Hi Everyone,
I am using Python 2.4 and I am converting an excel spreadsheet to a
pipe delimited text file and some of the cells contain utf-8
characters. I solved this problem in a very unintuitive way and I
wanted to ask why. If I do,
csvfile.write(cell.encode("utf-8
Hi Everyone,
I am using Python 2.4 and I am converting an excel spreadsheet to a
pipe delimited text file and some of the cells contain utf-8
characters. I solved this problem in a very unintuitive way and I
wanted to ask why. If I do,
csvfile.write(cell.encode("utf-8"))
I get a UnicodeDecodeE
Ok thanks. I'll avoid to do that.
--- Giampaolo
http://code.google.com/p/pyftpdlib/
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Nov 24, 2008 at 5:52 PM, Giampaolo Rodola' <[EMAIL PROTECTED]> wrote:
> Sorry for the title but I didn't find anything more appropriate.
> To have a less verbose code would it be ok doing:
>
> if a > b:
>
> ...instead of:
>
> if a is not None and a > b:
>
> ...?
> Is there any hidden compli
On Nov 24, 7:52 pm, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote:
> Sorry for the title but I didn't find anything more appropriate.
> To have a less verbose code would it be ok doing:
>
> if a > b:
>
> ...instead of:
>
> if a is not None and a > b:
>
> ...?
> Is there any hidden complication behi
Sorry for the title but I didn't find anything more appropriate.
To have a less verbose code would it be ok doing:
if a > b:
...instead of:
if a is not None and a > b:
...?
Is there any hidden complication behind that?
Thanks in advance
--- Giampaolo
code.google.com/p/pyftpdlib/
--
http://ma
On Jul 9, 2:24 am, "Rajanikanth Jammalamadaka" <[EMAIL PROTECTED]>
wrote:
> hi!
>
> Try this:
>
> >>> lis=['t','tes','test','testing']
> >>> [elem for elem in lis if re.compile("^te").search(elem)]
>
> ['tes', 'test', 'testing']
>
> Cheers,
>
> Raj
>
>
>
>
>
> On Wed, Jul 9, 2008 at 12:13 AM, Lamon
Rajanikanth Jammalamadaka a écrit :
(top-post corrected - Please, Rajanikanth, learn to trim"e properly,
and by all means avoid top-posting)
On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote:
Alright, basically I have a list of words in a file and I load each word
from
hi!
Try this:
>>> lis=['t','tes','test','testing']
>>> [elem for elem in lis if re.compile("^te").search(elem)]
['tes', 'test', 'testing']
Cheers,
Raj
On Wed, Jul 9, 2008 at 12:13 AM, Lamonte Harris <[EMAIL PROTECTED]> wrote:
> Alright, basically I have a list of words in a file and I load eac
Alright, basically I have a list of words in a file and I load each word
from each line into the array. Then basically the question is how do I
check if the input word matches multiple words in the list.
Say someone input "test", how could I check if that word matches these list
of words:
test
t
D'Arcy J.M. Cain a écrit :
On Wed, 28 May 2008 10:25:01 -
"James" <[EMAIL PROTECTED]> wrote:
Hey everyone,
I just started using python and cant figure this out, I'm trying to
make a program where someone types in a word and the program gives it
back backwards. For example if the person p
On May 28, 12:25 pm, "James" <[EMAIL PROTECTED]> wrote:
> Hey everyone,
>
> I just started using python and cant figure this out, I'm trying to
> make a program where someone types in a word and the program gives it
> back backwards. For example if the person puts in "cat" I want the
> program to
James a écrit :
Hey everyone,
I just started using python and cant figure this out, I'm trying to
make a program where someone types in a word and the program gives it
back backwards. For example if the person puts in "cat" I want the
program to give it back as "tac" and what it does is prin
On May 28, 11:25 am, "James" <[EMAIL PROTECTED]> wrote:
> word = raw_input("Type a word:")
> start = len(word)
>
> for letter in range(start, 0, -1):
> print letter
Hi James,
for letter in reversed(word):
print letter
--
Paul Hankin
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 28 May 2008 10:25:01 -
"James" <[EMAIL PROTECTED]> wrote:
> Hey everyone,
>
> I just started using python and cant figure this out, I'm trying to
> make a program where someone types in a word and the program gives it
> back backwards. For example if the person puts in "cat" I want
On Wed, 28 May 2008 10:25:01 -
"James" <[EMAIL PROTECTED]> wrote:
> I just started using python and cant figure this out, I'm trying to
> make a program where someone types in a word and the program gives it
> back backwards. For example if the person puts in "cat" I want the
> program to g
Hey everyone,
I just started using python and cant figure this out, I'm trying to
make a program where someone types in a word and the program gives it
back backwards. For example if the person puts in "cat" I want the
program to give it back as "tac" and what it does is prints out 3,2,1.
Ho
Chris wrote:
> It's very beautiful. Thanks
You think that's beautiful? Try these:
'abcdef'[::-1]
'abcdef'[::-2]
Cheers,
John
--
http://mail.python.org/mailman/listinfo/python-list
It's very beautiful. Thanks
jwoolard wrote:
> Chris wrote:
> > is there a prettier way to do this?
> > string[:len(string)-1]
> >
> > thanks!
>
> string[:-1]
>
> Negative indices count from the end of the string! beautiful isn't it?
--
http://mail.python.org/mailman/listinfo/python-list
Chris wrote:
> is there a prettier way to do this?
> string[:len(string)-1]
>
> thanks!
string[:-1]
Negative indices count from the end of the string! beautiful isn't it?
--
http://mail.python.org/mailman/listinfo/python-list
is there a prettier way to do this?
string[:len(string)-1]
thanks!
--
http://mail.python.org/mailman/listinfo/python-list
En/na xkenneth ha escrit:
> I want to be able to cycle through an array and print something in
> hexadecimal. Such as this
> thisArray = ["AF","0F","5F"]
> for x in range(len(thisArray)):
>print "\x" + thisArray[x]
>
> However python chokes on the escaped identifier, how can I get arou
xkenneth wrote:
> I want to be able to cycle through an array and print something in
> hexadecimal. Such as this
> thisArray = ["AF","0F","5F"]
> for x in range(len(thisArray)):
>print "\x" + thisArray[x]
>
> However python chokes on the escaped identifier, how can I get around
> this?
xkenneth a écrit :
> I want to be able to cycle through an array and print something in
> hexadecimal. Such as this
> thisArray = ["AF","0F","5F"]
> for x in range(len(thisArray)):
>print "\x" + thisArray[x]
>
> However python chokes on the escaped identifier, how can I get around
> th
I want to be able to cycle through an array and print something in
hexadecimal. Such as this
thisArray = ["AF","0F","5F"]
for x in range(len(thisArray)):
print "\x" + thisArray[x]
However python chokes on the escaped identifier, how can I get around
this?
Thanks!
Regards,
Ken
--
http
I'm glad to have helped. Good luck with your project.
--
Want to play tabletop RPGs over the internet?
Check out Koboldsoft RPZen:http://www.koboldsoft.com
--
http://mail.python.org/mailman/listinfo/python-list
Hi Dave,
Thanks for taking the time to reply to my posts. It really heped me
understand this better.
Thanks again.
Chris
--
http://mail.python.org/mailman/listinfo/python-list
Hi again. frameA in the __init__ is a parameter that is required to be
the FrameA object that is creating the FrameB. In my example, I was
assuming that the FrameB is created in a method of FrameA, so I created
it passing self as frameA:
w2 = FrameB(self, None, -1,"")
w2.Show()
--
HI Dave,
Thanks for the reply.
I am a bit confused by this piece of code:
class FrameB(wx.Frame):
def __init__(self, frameA, ...):
self.frameA = frameA
What is frameA in the __init__ definition?
Do I need to create something called frameA in order to pass it to that
__init__ func
Chris S wrote:
> Hello All,
> Just starting out with Python and wxPython. I have two Frames, FrameA
> and FrameB. FrameA opens FrameB when a button on FrameA is clicked. I
> can get this. Now I want a button on FrameB to update a control on
> FrameA. I am having an issue with this. Can anyone
A little further clarification. FrameA and FrameB are in different
modules.
Thanks.
Chris
--
http://mail.python.org/mailman/listinfo/python-list
Hello All,
Just starting out with Python and wxPython. I have two Frames, FrameA
and FrameB. FrameA opens FrameB when a button on FrameA is clicked. I
can get this. Now I want a button on FrameB to update a control on
FrameA. I am having an issue with this. Can anyone point me in the
right di
The problem may be something to do with using "threading" as identifier
name. It is name of a module and definitely what you want it done
anyway. You are better off having another variable as counter (with a
different name).
Raghu.
--
http://mail.python.org/mailman/listinfo/python-list
Let's say that I avoid the complexities of using classes, and that I avoid using anything to count the threads...
import socketimport threading
def scan(ip, port): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, port)) s.close() print '%s |
ed wrote:
> this script should create individual threads to scan a range of IP
> addresses, but it doesnt, it simple ... does nothing. it doesnt hang
> over anything, the thread is not being executed, any ideas anyone?
[SNIP]
> while threading < MAX_THREADS:
> scanThre
Why do you check if the module threading is less than 50? (this is why
nothing happens, it's always false).
>From where do you get port_counter in method run() of scanThread? (this
would make every call to run() raise an exception.
--
http://mail.python.org/mailman/listinfo/python-list
import socket
import thread
def scan(ip, port):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ip, port))
s.close()
print '%s | %d OPEN \nscanned: %d' % (ip, port, port)
except:
pass
ip = 'localhost'
for port in range(50, 5000
Fredrik Lundh wrote:
> Bryan Olson wrote:
>
>>Next, you never create any instances of scanThread.
>
>
> one would think that the "scanThread()" part of
>
> scanThread().start()
>
> would do exactly that.
And one would be correct.
I hereby retract that assertion of my post.
--
--B
maybe try this
while threading.activeCount() < MAX_THREADS:
#
instead of
while threading < MAX_THREADS:
--
http://mail.python.org/mailman/listinfo/python-list
Ah shoot, never mind, I'm an idiot. =0
--
http://mail.python.org/mailman/listinfo/python-list
This may be a really stupid question, but are you actually CALLING your
scan() function anywhere?
--
http://mail.python.org/mailman/listinfo/python-list
> "ed" <[EMAIL PROTECTED]> (E) wrote:
> import socket
> import threading
> import traceback
> def scan(ip, thebegin, theend):
> global ip
> global thebegin
> global theend
Making parameters global is a bad idea (I think). Moreover, thebegin and
theend aren't used in s
> Bryan Olson <[EMAIL PROTECTED]> (BO) wrote:
>BO> ed wrote:
>>> this script should create individual threads to scan a range of IP
>>> addresses, but it doesnt, it simple ... does nothing. it doesnt hang
>>> over anything, the thread is not being executed, any ideas anyone?
>BO> It's because
Bryan Olson wrote:
> Next, you never create any instances of scanThread.
one would think that the "scanThread()" part of
scanThread().start()
would do exactly that.
--
http://mail.python.org/mailman/listinfo/python-list
import socket
import threading
import traceback
class scanThread(threading.Thread):
def run(self):
try:
ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ss.connect((ip, port_counter))
print "%s | %d OPEN" % (ip, port_counter)
ss.cl
Well, I fixed those problems, now what I have is this:
but i am getting errors with the global variables or something ... am i supposed to use this class and def together differently? I just don't seem to understand ...
-edward
import socketimport threadingimport traceback
class scanThread(thr
ed wrote:
> this script should create individual threads to scan a range of IP
> addresses, but it doesnt, it simple ... does nothing. it doesnt hang
> over anything, the thread is not being executed, any ideas anyone?
It's because of the bugs. Nothing happens because
threading < MAX_THREADS
this script should create individual threads to scan a range of IP
addresses, but it doesnt, it simple ... does nothing. it doesnt hang
over anything, the thread is not being executed, any ideas anyone?
--
import socket
import threading
import traceback
MAX_THREADS = 50
class scanThrea
Simon Brunning wrote:
On Mon, 7 Mar 2005 18:58:20 -0500, Leeds, Mark <[EMAIL PROTECTED]> wrote:
I want to get rid of the beginning
And ending quotes.
my_string = '"8023 "'
my_string.strip('"')
'8023 '
Note the risk in this approach, as it blindly
removes any number of leading and trailin
On Mon, 7 Mar 2005 18:58:20 -0500, Leeds, Mark <[EMAIL PROTECTED]> wrote:
>
> I have a string variable say "8023 " and
>
> I want to get rid of the beginning
>
> And ending quotes.
Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "cre
--
Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany
Tel : +49 (0)351 4173 154
e-mail : [EMAIL PROTECTED]
Cenix Website : http://www.cenix-bioscience.com
--- Begin Message ---
Leeds, Mark wrote:
I have a string variable say “8023 “ and
Leeds, Mark wrote:
I have a string variable say “8023 “ and
I want to get rid of the beginning
And ending quotes.
I’ve tried different things
But haven’t had any success.
I’m definitely a python hacker and
Not an expert. Thanks.
>>> x = '"This is a quoted string"'
>>> print x
"This is a
If you simply wanted to get rid of quotes entirely, you could use:
"\"Hello!\"".replace( "\"" , "" )
However, since you only want the beginning and ending quotes removed:
>>> string = "\"If thou wert my fool, nuncle...\""
>>> print string
"If thou wert my fool, nuncle..."
>>> if string.startswi
I have a string variable say “8023 “ and
I want to get rid of the beginning
And ending quotes.
I’ve tried different things
But haven’t had any success.
I’m definitely a python hacker and
Not an expert. Thanks.
Mark
--
http://mail.
Jay donnell wrote:
in the code below 'print locals()' shows mc2. What is the equivalent
way to see the namespace that mc resides in?
class myClass:
--def func1(self):
self.mc = 1
mc2 = 3
print 'in myClass.func1'
print 'printing locals'
print locals()
print
I think you're loo
in the code below 'print locals()' shows mc2. What is the equivalent
way to see the namespace that mc resides in?
class myClass:
--def func1(self):
self.mc = 1
mc2 = 3
print 'in myClass.func1'
print 'printing locals'
print locals()
print
Google mungs up the spacing so I p
Hi,
Is there a method (or trick) in the PIL to set to set the alpha channel
of a png to zero? I can't find it in the handbook.
-thanks
--
http://mail.python.org/mailman/listinfo/python-list
92 matches
Mail list logo