@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> Is there anyway to make object immutable?
<1> posix4: why would you want that?
<2> string, tuple are already immutable
<0> drizzd: I have a friend who wants the read/write control he thinks he has in java
<0> SgtUnix: That is what I suggested
<1> I suppose one could write a cl*** with a getattr method...
<0> I told him i think he gives more credit to java than exists
<1> I'm just saying. You can have read/write control using the getattr method. Or simply using private variables (I mean the __identifier kind)
<0> k
<3> hi all!
<3> Anyone awake? I need some help with drawing a simple line on a Tkinter.Canvas
<3> thing is, nothing happens....
<3> hello?
<4> is there a way to 'break' out of if statements? I know that sounds stupid, but I dont want to have if else's inside if else's, inside if else's, etc.
<5> return
<6> short answer no, long answer you could make it a function and return, or raise an exception and catch it outside the if, etc.



<4> Yea, I thought raising the exception was the way to go.. figured I would ask first
<4> as usual, thanks :)
<6> chances are there's probably a better way to restructure the code so that neither are necessary, though
<5> function with return seems somehow cleaner than exceptions...
<4> Yea, I will have to look into this
<4> be a whole lot of new functions
<7> greetings
<7> so i was playing with netstat the otherday and got tired of typing netstat everytime i needed open port status
<7> my first attempt at a python script was an interactive netstat prompt
<7> works pretty well so far, but i'd like to parse the output to organize and index it on the fly
<7> ...yup
<7> hey ubajas
<7> anyone alive?
<8> Hi.
<7> hey
<6> q0m: what's your question, how to get the output of a shell command?
<7> i actually dont have one, i was just creating converstation, i know what i need to play with, the re module to parse the text after it's redirected to a file
<6> or you can just get the output directly with commands.getoutput
<7> either way, i have to learn some basic text parsing/indexing with python
<7> i'm just lazy...heh
<7> the code is bascially a netstat wrapper
<7> yawn, anyone lurking
<6> y
<7> how would you emplement a scrolling live window in Tkinter
<6> I don't really use Tkinter much
<7> whats a better alternative
<6> whatever text area control they have and just update it
<7> hmm text area control
<6> whatever the equivalent is in Tkinter, not sure offhand
<7> what do you use
<7> this python stuff is cool
<6> I don't use GUIs much, fortuntely
<6> fortunately*
<7> i've been playing with it over the last hour
<7> vpython is fun to toy with
<9> hi Im totally unfamiliar with python, but how do I install a missing library ?
<9> I need gtkmoz, is there something like CPAN for phyton ?
<9> python
<6> you need PyGTKMoz I take it?
<6> download it, run:: python setup.py install
<9> xihr, thanks
<10> re
<11> maryjane channel
<12> curious one
<12> how can I import a module that I don't have yet
<12> i.e: abcdefg = "os"; from abcdefg import system as hello
<12> "that I don't have the name of yet" would be a better way to describe that
<10> import imp
<12> thanks
<13> uhm
<13> back to the basics
<14> er det noe knulling p gang?
<15> naar is dat he, geen engels spreken :)
<15> q: i'm cross compiling C code to run on windows, which includes Python.h. unfortunately, the Python.h differs per system.. should i just try to obtain windows Python header files (and if so, how) or is there a better way?
<15> or is Python.h just included in the windows installer?
<16> Anyone who has worked with Python and XML / XML Schema ?
<17> Hmmm, i have an IP like: 1.2.3.4 , and i want to convert it to it's DWORD value, like: 0x010203FF
<17> does some1 know how i can arrange that?
<17> Google only helped me out finding some info about 'ctypes'
<18> DaF3: still there?
<17> yeh



<18> do you have a string '1.2.3.4', or do you have individual values?
<17> i have it in a string
<18> ok, do you need help getting out the individual values?
<17> well, if that is needed to get the DWORD value...
<18> you might want to look at the inet_aton function from the socket package
<18> s/package/module/
<17> then i would like to know (to split the string on a '.' and put it in a list would not be that hard
<17> yeh where reading about it
<17> import socket
<17> socket.inet_aton
<17> but didn't succeed
<17> Hmz, i got disconnected, did u said anything after my: [21:43:25] (DaF3): but didn't succeed
<17> ?
<18> no. what do you mean it didn't succeed?
<17> well -> Convert an IP address in string format (123.45.67.89) to the 32-bit packed
<17> binary format used in low-level network functions.
<17> i where not able to print / view the value it returns
<6> if you want help figuring out what you're doing wrong, you have to actually state what you did and how it went wrong
<6> "it didn't work" is not diagnostic
<17> yehn i know
<17> but when i do: print socket.inet_aton('1.2.3.4')
<17> it shows nothing
<6> you're doing something wrong, works here
<17> http://rafb.net/paste/results/c8C8Ia21.html
<6> yes
<6> that works here
<6> oh I see
<18> it doesn't show anything because it's a string of binary values
<6> it's a string
<6> yes
<6> they're unprintable characters
<17> what do you get back? cus i dont see anything
<18> you need to unpack it
<6> print repr(socket.inet_atom('1.2.3.4'))
<6> err, inet_aton
<6> the doc string you quoted says what it does -- it returns a 32-bit packed binary format, i.e. a string
<17> '\x01\x02\x03\x04'
<17> yeh, ok, but i want to get the DWORD value of it
<6> then unpack it
<17> 1.2.3.4 --> 0x010203FF
<17> hmm
<18> this does the trick for me print '0x%08x' % socket.ntohl(struct.unpack('l', socket.inet_aton('1.2.3.4'))[0])
<17> let me see
<17> 0x01020304
<17> hmm, seems to work right indeed
<17> nice mate, thnx drizzd_
<17> only the print u do, what is %08 representing for type?
<17> long?
<18> %x is for hexadecimal, the leading 8 means that you want to print at least 8 characters, so if the actual number is shorter than that, you want it to be preceded by zeros (that's what the leading 0 is for)
<17> ok clear! thnx !!
<19> is it possible to do prototyping in python?
<19> as in c?
<20> You've lost me.
<19> me?
<18> Well, not out of the box AFAICT. But you can define interfaces using abstract cl***es.
<19> what do you do when cl*** a contains cl*** b and vice versa?
<18> what's the problem with that?
<19> the problem is.
<19> cl*** Account:
<19> contact = Contact()
<19> cl*** Contact:
<19> account = Account()
<19> an account needs a contact and a contact needs an acccount.
<18> well, you have to initialize one member first
<19> an example ? =)
<18> cl*** Account:
<18> contact = Contact()
<18> def __init__(self): contact.account = self
<21> does every Contact need the same Account?
<19> no
<21> then you should probably be setting it in __init__ anyway
<21> cl*** Account:
<21> def __init__(self):
<21> self.contact = Contact()


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

#politics
#worldcup
#linuxhelp
hex2ascii online
#nintendo
#bsd
#politics
xtcrew
#beginner
midave



Home  |  disclaimer  |  contact  |  submit quotes