#apache #archlinux #asterisk #centos #debian #gentoo #haskell #kde #kubuntu #lisp #math #mysql #perl #python #ruby-lang #rubyonrails #suse #ubuntu #vim #wikipedia 0 1 2 3 4 5 6 7 8 9 10 11 12 13 
Top Prev 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 Next

#python

<pjd> dionoea: this style of "pass object reference by value" is often known as "pass by object"
<ogzy> insanekane: so how will add the program itself to cron?
<insanekane> ogzy: well, you can read the config file whenever it is called by cron, and the modify its cron settings
<insanekane> ogzy: no idea. use the force ?
<ehird> anyone?
<pjd> dionoea: technically, it does work like c with a pointer to an int; the difference is that python's int's are immutable
<pjd> "ints", even
<dionoea> oh, ok :) (well ... .increment() still changes the value :p)
<insanekane> pjd: :))
<ogzy> insanekane: forcing is not a good idea
<insanekane> ogzy: :))
<kosh> python is pass by object always, it does not work like pass by value or pass by reference as understood by c/c++
<pjd> dionoea: think of a C program where all variables are single-level pointers, and you pretty much have exactly Python's behavior
<kosh> in python you have names and objects, the names are just a handle for an object, they don't realy work like variables do
<dionoea> void foo( int *a ){*a = *a +1 } would change the value in the claller
<kosh> whenever you use = you rebind a name to a new item
<dionoea> *caller
<kosh> since you can't mutate an int when you use = you just rebind a new name
<pjd> dionoea: the difference is that Python ints are immutable
<kosh> a = a + 1 binds the name a to the object that is the result of a + 1
<marienz> if you think c they're all PyObject*s
<dazjorz> Hi
<kosh> it does not modify a since a can never be modified anyways, it is just a handle
<kosh> the reason you can do somelist.append(value) and have it mutate is that somelist is a mutable item and you did not use = to rebind anything
<ehird> Anyone?
<dionoea> so can i do something like a.set( a + 1 ) to change the value of the previous object instead of instantiating a new one ? (like a.increment() would do)
<dazjorz> I'm not a Python programmer, but I'm doing a project with two
<kosh> dionoea: no
<dazjorz> We're trying to make a server and client combination with an XMPP protocol in between
<pjd> dionoea: the assignment works more like foo( int *a ){a = &(*a + 1) }
<kosh> dionoea: intergers can not be modified
<dazjorz> Both of the Python programmers aren't reachable, so I ask here; does Python have an XMPP library ?
<Chousuke> It's logiccal: adding 1 to 1 doesn't suddenly make "one" mean "two"
<Chousuke> -c
<pjd> dazjorz: Twisted has one, i think
<kosh> ehird: I am not sure what you are asking
<ehird> kosh: i have a function, say
<ehird> myFunc
<pjd> dazjorz: also, http://pyxmpp.jajcus.net/
<ehird> myFunc is defined as
<ehird> def myFunc(one, two, three)
<ehird> if i have myFunc, how can I get 3? i.e. the number of arguments it atkes
<dazjorz> pjd: Okay, thanks! :)
<kosh> ehird: why would you want to?
<ehird> kosh: various reasons
<pjd> ehird: inspect
<kosh> the fact that you are trying to do it is probably the result of a design problem
<pjd> specifically getargspec, most likely
<kosh> that is why I wanted to know why you want to do it so we can suggest a better way to do it
<pjd> but you very probably don't want to do that, really

Previous Page  Next Page

Search ircarchive.info