Re: Quick question about CPython interpreter

2022-10-17 Thread Chris Angelico
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

Re: Quick question about CPython interpreter

2022-10-17 Thread MRAB
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

Re: Quick question about CPython interpreter

2022-10-17 Thread David Lowry-Duda
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

Re: Quick question about CPython interpreter

2022-10-17 Thread Michael Torrie
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 > > > ---

Quick question about CPython interpreter

2022-10-17 Thread DFS
- this does a str() conversion in the loop - for i in range(cells.count()): if text == str(ID): break

Re: [pypy-dev] A quick question for you!

2018-06-19 Thread William ML Leslie
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

Re: [pypy-dev] A quick question for you!

2018-06-19 Thread Etienne Robillard
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

A quick question for you!

2018-06-18 Thread Etienne Robillard
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

Re: Just a quick question about main()

2017-10-27 Thread Ian Kelly
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

Re: Just a quick question about main()

2017-10-27 Thread Ian Kelly
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

Re: Just a quick question about main()

2017-10-27 Thread Ned Batchelder
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

Re: Just a quick question about main()

2017-10-27 Thread Grant Edwards
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

Re: Just a quick question about main()

2017-10-27 Thread Thomas Jollans
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,

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
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

Re: Just a quick question about main()

2017-10-27 Thread Chris Angelico
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

Just a quick question about main()

2017-10-27 Thread ROGER GRAYDON CHRISTMAN
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

Re: Quick question, if you please

2015-03-31 Thread John Gordon
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,

Re: Quick question, if you please

2015-03-31 Thread Russell Owen
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

Quick question, if you please

2015-03-31 Thread John Kelly
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

Re: Quick Question About Setting Up Pytz

2014-10-20 Thread Mark Lawrence
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

Re: Quick Question About Setting Up Pytz

2014-10-20 Thread Ryan Shuell
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Rustom Mody
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.

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Chris Angelico
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Ben Finney
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Ben Finney
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Chris Angelico
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread ryguy7272
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Mark Lawrence
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

Re: Quick Question About Setting Up Pytz

2014-10-18 Thread Joel Goldstick
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

Quick Question About Setting Up Pytz

2014-10-18 Thread ryguy7272
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

pexpect on windows - child process of another child process - quick question

2013-03-09 Thread Z W
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 -

Re: python logging module:a quick question

2011-12-27 Thread Lie Ryan
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

python logging module:a quick question

2011-12-26 Thread Littlefield, Tyler
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,

Re: Quick question about threads and interpreters.

2011-07-31 Thread Chris Angelico
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

Quick question about threads and interpreters.

2011-07-31 Thread Ira Gray
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

Re: UnicodeDecodeError quick question

2008-12-04 Thread Tim Golden
[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

UnicodeDecodeError quick question

2008-12-04 Thread patrick . waldo
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

Re: Quick question about None and comparisons

2008-11-25 Thread Giampaolo Rodola'
Ok thanks. I'll avoid to do that. --- Giampaolo http://code.google.com/p/pyftpdlib/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Quick question about None and comparisons

2008-11-24 Thread Chris Rebert
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

Re: Quick question about None and comparisons

2008-11-24 Thread r
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

Quick question about None and comparisons

2008-11-24 Thread Giampaolo Rodola'
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

Re: Regular Expressions Quick Question

2008-07-09 Thread Paul McGuire
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

Re: Regular Expressions Quick Question

2008-07-09 Thread Bruno Desthuilliers
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

Re: Regular Expressions Quick Question

2008-07-09 Thread Rajanikanth Jammalamadaka
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

Regular Expressions Quick Question

2008-07-09 Thread Lamonte Harris
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

Re: A quick question

2008-05-28 Thread Bruno Desthuilliers
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

Re: A quick question

2008-05-28 Thread Chris
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

Re: A quick question

2008-05-28 Thread Bruno Desthuilliers
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

Re: A quick question

2008-05-28 Thread Paul Hankin
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

Re: A quick question

2008-05-28 Thread D'Arcy J.M. Cain
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

Re: A quick question

2008-05-28 Thread D'Arcy J.M. Cain
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

A quick question

2008-05-28 Thread James
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

Re: super quick question

2006-08-04 Thread John Machin
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

Re: super quick question

2006-08-04 Thread Chris
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

Re: super quick question

2006-08-04 Thread jwoolard
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

super quick question

2006-08-04 Thread Chris
is there a prettier way to do this? string[:len(string)-1] thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Quick Question

2006-06-22 Thread Alexis Roda
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

Re: Quick Question

2006-06-22 Thread Carl J. Van Arsdall
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?

Re: Quick Question

2006-06-22 Thread Bruno Desthuilliers
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

Quick Question

2006-06-22 Thread xkenneth
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

Re: Quick Question regarding Frames

2006-03-30 Thread Dave Mandelin
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

Re: Quick Question regarding Frames

2006-03-29 Thread Chris Seymour
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

Re: Quick Question regarding Frames

2006-03-29 Thread Dave Mandelin
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() --

Re: Quick Question regarding Frames

2006-03-28 Thread Chris S
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

Re: Quick Question regarding Frames

2006-03-28 Thread Dave Mandelin
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

Re: Quick Question regarding Frames

2006-03-28 Thread Chris S
A little further clarification. FrameA and FrameB are in different modules. Thanks. Chris -- http://mail.python.org/mailman/listinfo/python-list

Quick Question regarding Frames

2006-03-28 Thread Chris S
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

Re: threads/sockets quick question.

2005-09-19 Thread [EMAIL PROTECTED]
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

Re: threads/sockets quick question.

2005-09-19 Thread Ed Hotchkiss
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 |

Re: threads/sockets quick question.

2005-09-19 Thread dowskimania
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

Re: threads/sockets quick question.

2005-09-19 Thread Simon Percivall
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

Re: threads/sockets quick question.

2005-09-19 Thread n00m
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

Re: threads/sockets quick question.

2005-09-19 Thread Bryan Olson
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

Re: threads/sockets quick question.

2005-09-19 Thread antred
maybe try this while threading.activeCount() < MAX_THREADS: # instead of while threading < MAX_THREADS: -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread antred
Ah shoot, never mind, I'm an idiot. =0 -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread antred
This may be a really stupid question, but are you actually CALLING your scan() function anywhere? -- http://mail.python.org/mailman/listinfo/python-list

Re: threads/sockets quick question.

2005-09-19 Thread Piet van Oostrum
> "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

Re: threads/sockets quick question.

2005-09-19 Thread Piet van Oostrum
> 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

Re: threads/sockets quick question.

2005-09-19 Thread Fredrik Lundh
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

Re: threads/sockets quick question.

2005-09-19 Thread ed
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

Re: threads/sockets quick question.

2005-09-19 Thread Ed Hotchkiss
  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

Re: threads/sockets quick question.

2005-09-19 Thread Bryan Olson
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

threads/sockets quick question.

2005-09-18 Thread ed
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

Re: quick question

2005-03-08 Thread Peter Hansen
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

Re: quick question

2005-03-08 Thread Simon Brunning
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

[Fwd: Re: quick question]

2005-03-08 Thread Neil Benn
-- 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

Re: quick question

2005-03-07 Thread Steve Holden
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

Re: quick question

2005-03-07 Thread Daniel Bickett
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

quick question

2005-03-07 Thread Leeds, Mark
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.

Re: a quick question about namespaces

2005-02-01 Thread Steven Bethard
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

a quick question about namespaces

2005-02-01 Thread Jay donnell
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

PIL: Quick Question

2005-01-05 Thread flamesrock
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