| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Comments:
<0> :( <1> pythonwin = weird behavior <0> sure does :( <2> * + firefox = weird behaviour <1> i use emacs myself, tho i also have SPE sitting around not doing anything <2> firefox = weird behaviour <2> :P <3> Hello all! What would be the "best" way to find the dotted path of an objects cl***? <3> object.__cl***__.__module__ + extracting the cl*** name for object.__cl***__, or some other way? <3> I googled but couldn't find anything. <2> the dotted path? <3> Yeah, like datetime.datetime <3> Or mymodule.something.foo.MyCl***. <2> look in sys.modules? <3> Ehm, but thats a list of modules, isn't it?
<4> is there a way to use sorted() in python2.3 -- i.e. some code i can copy? right now i just defined a function sorted(l): l2=copy.copy(l); l2.sort(); return l2 <2> list of loaded modules <5> regebro: twisted has a function to do this you could look at: twisted.python.reflect.qualify() <5> regebro: i don't think it works particularly well <1> modules don't have a path hardwired into them like java cl***es do. the path only resolves the module, but the module only has an unqualified name <1> s/cl***es/packages/ <6> mcmillen_: well, that's basically it <3> joedj: OK, I'll check it out. Do you know if there is any specific problems with it? <6> except maybe you just would do l2 = list(l) <6> to support any iterable <6> and add those keyword arguments <6> mcmillen_: it won't be as fast as sorted() - which I think is optimized for this kind of "insertion sort" technique <3> sproingie: Well, in this case I don't care about modules, just objects. <5> regebro: i don't recall <4> all right. mostly i was wondering if the actual function is written in python somewhere, so that i could just copy the source. but if it's written in C, i'll just stick with what i have <3> ok, thx. <6> mcmillen_: I'm afraid it's written in C, but you might find an earlier Python in the PEPs <1> regebro: then you're even more out of luck. objects have no idea what module they belong to <1> regebro: technically they belong to every module that imports them <3> object.__cl***__.__module__ seems to work for me. <4> stain: thanks for the help! <3> sproingie: Ah, OK, now I understand. <7> sproingie: Well, you could probably localize code objects, and access the "globals", but that's really an ugly hack. <3> That's not a problem per se. As long as I can import it (which I can) I'm fine. <3> I think. :) <1> ok, i'm wrong again, big surprise ... __module__ indeed does it. not going to give you qualified names tho. <8> if you already have a reference to the cl***, why would you need to reimport its module? <3> I don't have a reference to the cl***. I have an object. <1> object.__cl***__ <8> regebro you have a name of an object, which is a reference to that object <8> the unnamed object is just floating around in memory <3> No, I have an OBJECT. Not teh name. The OBJECT. <8> I don't believe you <3> joedj: twisted just does cl***.__module__ + '.' __cl***__.__name__ <3> Zalamander: Beleive it. <8> regebro no <8> regebro I think you are misunderstanding something about names/objects in Python <3> OK, so explain. <8> regebro "objects" exist in memory. "names" are references to objects. You can't "have" an object in a python program unless you have at least one "name", i.e., reference, for it <1> last i looked names were strings <8> no they aren't <1> what an amusing bit of epistemology <8> but the real point is not what names are ... the real point here is "why import a cl*** that you already have a reference to?" <3> Zalamander: No, "names" are not referencce, and everythins references. I have a reference, i.e. an object. <3> What I need, is the import path of the object. <3> As a string. <8> regebro yes, I understand what you need. I only asked why. <1> you can get the unqualified name of the module, but i think the qualified path gets thrown away <3> No, Zalamander, you told me I had misunderstood it. ;) That's not asking why. ;) <9> Zalamander: You may have a reference but not know where it is <8> regebro <8> if you already have a reference to the cl***, why would you need to reimport its module? <2> m0no: use opera :P <8> that was the first thing I said to you regebro <1> at least it does in the module you imported. you could probably grovel sys.modules to match them up <3> I'm not qure I understand the difference between qualified and unqualified in this context. <8> Brend agreed. That's why I asked why one would need to know? <1> regebro: qualified: foo.bar.modulename. unqualified: modulename <3> The reason why is an export/import thingie. <8> regebro but I do maintain that you don't "have" the object. You "have" a reference to the object (Unless you can somehow visually interpret electronic impulses in capacitors) <3> Snce everything in python is references, that is a compltely useless distinction.
<8> regebro ok, I don't understand that reason <8> regebro no, it isn't. Not in this case <3> It's fine, you don't have to. My question has been answered, and yes, it is. <8> it's exactly the important distinction. You can export something from the CURRENT namespace, without knowing where the cl*** is defined <8> because you have a LOCAL reference to it <3> I will not have a local reference to it. <1> Zalamander: no one is impressed by your ability to distinguish references from values <3> It's not a problem. <8> then you won't be able to look it up <1> Zalamander: in python, "object" is synonymous with references. you're correcting someone for confusion that doesn't exist <8> sproingie hey, **** off :-) <3> Yes, I will be able to look it up. In fact, I just did. <1> same thing happens in java too, tho there some people actually do expect p***-by-value to happen for some ungodly reason <1> anyway, object.__cl***__.__module__ gives you the name of the module (very much a string), and sys.modules has the qualified names and the module objects ... beats hell out of me how you can get a reference to the module of an arbitrary cl*** <10> hi <3> 'arbitrary'? <1> arbitrary, given, anonymous, whatever <1> long as you don't have any overlapping module names, it's just a matter of matching up the module name with the keys in sys.modules <1> if they do overlap ... good luck <3> Well, well see, but I don't think this is going to be a problem, really. <1> it's a one-liner code exercise i'm too lazy to figure out <11> Is there an easy way to create an html-file with syntax highlighted python code? <1> sp3tt: enscript <1> sp3tt: http://www.codento.com/people/mtr/genscript/ <11> Found a plugin for jEDit. <1> jedit++ <1> could use a new maintainer, considering its author has sworn off java <11> Nice, the plugin generates valid html, except for a doctype. <1> how hard is it to generate valid html for colors and fonts? <12> sproingie, fairly easy <13> anyone here works with pygtk? <14> yep <13> Juhaz, do you know how can i have 2 windows but dont let the focus go to the back window till you click OK on the first? <15> sorted as raw strings, not alphanumerics <-- what is raw string ? <14> sapo, um, I'm sure there are ways to accomplish that entirely by hand, by if you need a modal dialog, why don't you just use one? <13> hum.. modal <13> i m new to it.. i m using glade.. its working but i m kinda lost with some stuff <16> sapo, new to Python? <13> kinda <13> i m playing with it a lot latelly :) <13> now i m trying to convince my boss that python is worth for desktop apps.. i m making some server side scripts in python and they are working fine, but i m starting with gui stuff <17> what are they currently considering sapo: <13> just for testing i m trying to make a app that asks for your user and p***word, this login window is working <14> http://pygtk.org/pygtk2reference/cl***-gtkdialog.html#constructor-gtkdialog http://pygtk.org/pygtk2reference/cl***-gtkwindow.html#method-gtkwindow--set-modal <13> but i want to lock the focus on it till you login <18> solsTiCe_: A raw string is a string literal prefixed with r which makes the parser not use \ as a escape char. That term doesn't apply to your sentence though. <13> Juhaz, thanx i ll take a look <15> Erwin: ok <19> sapo: what os and platform requirements for your gui stuff offhand? <14> sapo, I don't have glade at hand right now, but pretty sure that the gtk.DIALOG_MODAL flag can also be set trough it <17> sapo: What are they planning to use for the gui ? <13> Juhaz, thanx man.. this worked like a charm: Tree.get_widget("login").set_modal(True) <13> JoaoJoao, hum.. we actually make commercial applications for small companies using delphi.. but i hate delphi.. and we are starting to make a new project and i m in that project.. i dont wanna make that stuff in delphi <17> sapo: You may have a hard time convincing them to dump the Delphi's rad <13> JoaoJoao, i think i ll, but i have some credits with my boss.. everything i said till now worked, so he will consider if i show him something that already works.. thats why i m making an example right now :) <20> sapo, I've heard people combining Python and Delphi to good effect; doing UI dev in Delphi and the "guts" in Python <17> yes there is a Python component for Delphi <13> benji, hum... never heard about this combination O_o <13> what i really hate about delphi is that object pascal stuff <18> Or you can skip Delphi altogether and use e.g. dabo, which is a 3-tier Python-based toolkit <13> delphi itself is a good rad, but that language give me nighmares <13> dabo? <17> Delphi is dying <17> Delphi 2005 ****s <13> JoaoJoao, yep.. borland is even selling it.. lol <3> Pah, just because it's an ugly shim with some parts undocumented= That's not reason to hate it. :) <17> I'd rather use VisualStudio, it's nice <21> Hi :) <17> regebro: And very slow, and buggy, did I mention it's slow? :) <13> Ghawk, yo <3> I like how object pascal tries to pretent that you don't need pointers. It's sooo...pathetic. :-P <17> what saves delphi is the wealth of libraries and components for it
Return to
#python or Go to some related
logs:
#openzaurus uchromep linux #linux Gtk-WARNING **: cannot open display: in linux CentOS 5.0 #centos #mysql up2date cups bus error richzo keymap evbug xorg gcc: cannot specify -o with -c or -S and multiple compilations
|
|