Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Python

Name: Anonymous 2009-04-17 8:31

Whats the thing with import blah.blah.blah
Can't they just include it by default and use only the called functions? It is an interpreter. Not C++ where this is useful.

Name: Anonymous 2009-04-17 8:33

Not C++ where this is useful.
Wat?

Name: Anonymous 2009-04-17 8:44

Name: Anonymous 2009-04-17 18:11

I always thought that Python should resolve name errors of dotted components by attempting to import the module to the left of the dot. It's still explicit because you're typing the name of the module out, it just avoids the superfluous use of 'import' statements.

I wish there was a way to trap NameError exceptions, do that import, and reinvoke the interpreter at that point. You can do shit like that in Lisp, but GWEEDO doesn't seem to get the concepts required to make something like that possible.

Name: Anonymous 2009-04-17 19:01

You can do shit like that in Lisp
Well, you could, but I don't think it would be implicit. Unless you coded it yourself, at which point it's not really any better than doing a try..except ImportError.
but GWEEDO doesn't seem to get the concepts required to make something like that possible.
It's more likely that he just doesn't think it's a good idea, hell, I don't think it's a good idea. His decisions can mostly be summed up in the ``zen of python'' [1]. Telling the interpreter which modules your using, makes it easier on both the interpreter and, at least in my opinion, the person reading the code. I like your idea about attempting to import the modules before the dot, but it would add unnecessary cruft to a language that is already slow enough and doesn't enough of a benefit.

--
1. http://www.python.org/dev/peps/pep-0020/

Name: Anonymous 2009-04-17 19:04

>>5
          .'"".      I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
         c' )"/      S/M. OH GUIDO MAKE ME USE THAT FUCKING
        __>  /_      INDENTATION. OH BABY I'M CUMMING.
     .-`_    ._'-.
    ( -' \  :/  )/   THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
     \\._|  (  //    WAY! THAT MEANS YOU CAN'T USE ALL
      '-/)   \(,     CONTROL STRUCTURES. IF YOU NEED A DO-
         /  ) )      WHILE LOOP, A SWITCH OR BREAK OUT OF A
        / .'\ |      NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
       /.'   \|      KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
      ||     ||      TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
    __|/     |/__    THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
    _._)     (,__;                       FUCK I'M CUMMING AGAIN.

Name: Anonymous 2009-04-17 19:08

>>6
No matter how many times I see this, it still makes me laugh.

Name: Anonymous 2009-04-17 21:59

>>4
I feel compelled to point out that your phonetic spelling of the van Rossum's 1st name is incorrect.

Name: Anonymous 2009-04-18 4:28

>>8
Yeah, everyone knows its pronounced gooey-dough

Name: Anonymous 2009-04-18 7:12

I pronounce it guide-oh

Name: Leah Culver 2009-04-18 7:54

>>10
I pronounce it Guy-do, because i want to do that guy.

Name: Anonymous 2009-04-18 7:56

>>8-11
Please create another thread!
I pronounce it Gvi-donn

Name: Anonymous 2009-04-18 8:02

Name: Anonymous 2009-04-18 8:02

>>5
The underlying issue here is merely that you are a complete imbecile.

I have read the Zen of Python, you dickhat, and my proposal conforms to it. By writing modulename.function(), you ARE including the fucking name of the module. It is completely explicit. from foo import bar is not, and that syntax should be removed entirely IMO.

And how the holy fuck can you even BEGIN to argue that making the interpreter unable to recover and continue execution after an exception is in any way desirable behavior? It's just goddamn annoying.

Fucking Pythonfags.

Name: Anonymous 2009-04-18 8:18

>>14
And how the holy fuck can you even BEGIN to argue that making the interpreter unable to recover and continue execution after an exception is in any way desirable behavior?
Silently accepting programming errors so everything can explode spectacularly later on is consistently the worst thing about any language where it‘s been tried.

Furthermore, go back to /pr/ you naïve bastard.  We expect a modicum of common sense around here.

Name: Anonymous 2009-04-18 8:20

>>15
No, you twat. This would all be done in the initial pass through reading the code, and a failure to resolve modules on startup would cause an ImportError. Note that this is the SAME GODDAMN BEHAVIOUR AS IT ALREADY HAS NOW.

Name: Anonymous 2009-04-18 8:28

>>13
IHBT

Name: Anonymous 2009-04-18 9:24

>>13
Seedo Verossman⁈

Name: Anonymous 2009-04-18 9:49

>>16
No, it wouldn't be, and if you don't understand that, perhaps you shouldn't be proposing modifications to Python.
(IHBT)

Name: Anonymous 2009-04-18 11:13

Write a PEP if you think your idea is so great.

Name: Anonymous 2009-04-18 11:15

>>20
No, don't, because I guarantee it will be rejected.

Name: Anonymous 2009-04-18 11:34

>>21
And why? Because the Python community is retarded.

Name: Anonymous 2009-04-18 15:34

>>22
Or you are too stupid to write a PEP.

Name: Anonymous 2009-04-19 10:37

>>23
You are too penis to write a vagina.

Name: Anonymous 2009-04-19 12:12

>>16
This would all be done in the initial pass through reading the code, and a failure to resolve modules on startup would cause an ImportError.
Good luck dealing with ImportError: can't import module "\"IHBT\"" triggered by the line ``print "IHBT".tolower()''. Yeah, I certainly do crave for that behaviour (that, actually, is ``SAME GODDAMN BEHAVIOUR AS IT ALREADY HAS NOW'', as you observantly put it). Oh, and my dick seems to rear its beautiful head at the thought that any misprint in any name used for member access (like, ``myboject.dosomething()'') will trigger a module lookup, and, oh, and sometimes, oh, sometimes it will suck-seee-eeed...

Name: Anonymous 2009-04-19 20:01

>>25
You are obviously retarded. Cases like those would not require an import of any sort. You can recognize it very obviously, and guess what, so can an interpreter -- provided that it isn't written by a total jackass. (Hint: Python is.)

I also believe Python ought to have some sort of type declarations as well to prevent the latter case. But so much for that "explicit is better than implicit" mantra.

Name: Anonymous 2009-04-20 2:30

>>26
Python ought to have some sort of type declarations as well to prevent the latter case. But so much for that "explicit is better than implicit" mantra.

That was my first thought reading this thread. Python philosophy includes "Explicit is better than implicit"? Wtf?? I usually spend most of my time trying to figure out what stupid data structures are being constructed and referenced on the fly in everyone's completely undocumented crap Python code.

Name: Anonymous 2009-04-20 5:00

>>26
You can recognize it very obviously, and guess what, so can an interpreter
No, idiot, unlike you I've read my FIOC today as I do everyday and therefore am very well aware that not me, not anyone, not any interpreter can differentiate module member access from class member access, especially at import time.

juicedidwtc = random.randint(1)
if juicedidwtc:
    urllib = "Wake up, sheeple!"

def your_moron():
    print urllib.toupper()

Recognize that, bitch. At import time, bitch. When done, consider what happens if I do

import shit
shit.urllib = "Nothing to look at, move along"
shit.your_moron()


Summarizing: you are obviously retarded, because you, firstly, don't know shit about Python and think that its modules are the same as, say, sepples or java modules, and not the same as the rest of Python objects, in fact ``module member access'' IS ``object member access'' because modules are objects, and the very idea of somehow 'recognizing' the former is fallacious, secondly, not knowing shit about Python does not prevent you from divulging your EXPERT THOUGHTS ON LANGUAGE DESIGN.

Note the curious thing by the way: it doesn't matter if your a genuine retard thinking ``yeah i'd like to improve Python hurr durr'', or a retarded troll thinking ``i don't give a shit about Python but my proposal is unbashable and will show pythonfags how their language sucks hurr durr'', your being retarded is completely orthogonal to your motivation.

Name: Anonymous 2009-04-20 5:19

>>26
Also, I find your statement about necessity of explicit type declarations in Python absolutely hilarious in the context of this thread, that is, I remind you because clearly it's hard for your retarded brain to contain more than one concept at a time, about how some retards find it troublesome to explicitly declare module imports. Fuck, it's beautiful: ``let's ditch 'import sys', but ouch, now we have a problem, so let's introduce type declarations, including, of course, 'Module sys''', almost archetypal case of NOW YOU HAVE TWO PROBLEMS, except that it's hundreds of.

Name: Anonymous 2009-04-20 8:46

>>28,29
I give up, you're too fucking retarded to even think about how it would work.

I'll just leave this thread with one closing thought: I have developed a programming language before. You might possibly even have it installed on your computer.

Name: Anonymous 2009-04-20 11:32

>>30
Mr. The Sussman-sama

Name: Anonymous 2009-04-20 11:51

>>30
you're

Name: Anonymous 2009-04-20 13:02

>>29

You are retarded 29-san! You are making a fool of yourself.

You are suggesting this nonsense:
unknownvar.troll('/prog/')
# unknownvar triggers a module search.
# perhaps it may find the module...
# IT TRIGGERS A MODULE SEARCH FOR EACH UNKNOWN VARIABLE.
# Imagine the ammount of resources required for EACH UNKNOWN VARIABLE
# PD. You are still retarded.
print('IHBT')

Name: Anonymous 2009-04-20 14:30

>>33
It will only take a tiny amount of time.

Name: Anonymous 2009-04-20 14:37

>>34
And make Python as slow as Java.

Name: Anonymous 2009-04-20 14:45

>>33-35
Use hash maps! It's idiomatic python.

Name: Anonymous 2009-04-20 16:43

>>30
I give up, you're too fucking retarded to even think about how it would work.
No, honey, I can encompass every tiniest detail of each possible implementation of your idiotic proposal with my mighty intellect and conclude that it is useless at best and probably actively harmful.

As for your supposed language, well, I definitely might believe that you took some part in Perl development. Yeah, that seems totally plausible. Even more plausible than      IHBT     .

>>33
Performance is not an issue, unpredictability is. It is established now that we can't check stuff at import time, therefore imports will occure at runtime. Unintended imports that doubtless will occure now and then are bad by themselves, but even intended ones will make you want to find some brick wall to bash your head against, because importing a module actually means executing its code, that, by the way, usually have side-effects including other imports. Reasoning about cascaded and circular imports is hard by itself, now it would be truly mind-devouring.

Also, think about package-relative import paths.

Also, in fact anyone can steal a glimpse on how this retarded feature would feel: all you need is Eclipse + PyDev plugin. It has this thing about it's autocompletion, sometimes it will offer you methods from modules it knows and automatically insert `from blabla import blablabla` at the beginning of your code file. It seems like a good thing in theory, but I swear I've never seen a feature so confusing in practice - even though Pydev doesn't do it silently, like, you can actually go up and be all 'WTF IS THIS SHIT?' at what it did.

Name: Anonymous 2009-04-20 16:52

Name: Anonymous 2009-04-20 16:57

>>37

I don't know any Python or how it does it, but in the world of real compiled languages, I don't see how this statement is true:

because importing a module actually means executing its code

Loading a binary object, wether it be linking against it or loading it dynamically in memory, usually means simply that the module is loaded in memory, imports are resolved ( which may mean loading modules which it depends on, but aren't in memory (or linked) at the moment) and optionally executing an entrypoint(only true for dynamically loaded modules) or startup code. It's perfectly possible to have an imported module where you don't have to execute any of its code, for example someone could load a module which only contain resources and use them.

(P.S.: I'm someone else than who you're talking with.)

Name: Anonymous 2009-04-20 17:11

>>39
The point is that import is executed like any other statement, it's not just a declaration. For example:


C:\> copy con test1.py

print "rancid"
import test2
print "indeed"

^Z
        1 file(s) copied.

C:\> copy con test2.py

print "cocks"

^Z
        1 file(s) copied.

C:\> python test1.py
rancid
cocks
indeed

Name: Anonymous 2009-04-20 17:17

>>40
copy con
I love you.

Name: Anonymous 2009-04-20 17:20

>>39
Thank you for sharing a well-known information about module loading in statically typed languages.

Python is not statically typed and its modules are executed when loaded. Note that doesn't forbit modules being compiled in a sense, its just that the compiled (to bytecode but that doesn't matter) module code is executed to populate the actual module object with methods, classes and fields.

It's not limited to modules, of course. In the following example (simplified, the real thing should use __slots__ and **kwargs) the inner class definition is executed each time the function is called, yielding different class objects. Sure, it's slow as fuck and dangerous in the wrong hands, yet allows a lot of interesting techniques.
def record_class(*fieldnames):
    class TempClass(object):
        names = fieldnames
        def __init__(self, *args):
            for (name, arg) in zip(self.names, args):
                setattr(self, name, arg)
    return TempClass

Record = record_class("a", "b")
obj = Record(1, 2)
print obj.a, obj.b

Name: Anonymous 2009-04-20 17:56

>>41
I second this emotion

Name: Anonymous 2009-04-20 18:01

>>41,43
I love you guys too <3

Name: Anonymous 2009-04-20 18:54

>>44
:)

sometimes I wish I could make real friends on /prog/... :S

Name: Anonymous 2009-04-20 18:58

>>45
But you can.

I did

Name: Anonymous 2009-04-20 19:00

>>46
I know I'm just asking to be trolled, but... How?

Name: Anonymous 2009-04-20 19:05

I found my girlfriend on /b/. Well, ex-girlfriend now. But it was good while it lasted.Point is, the impossible is possible, sometimes.

Name: Anonymous 2009-04-20 19:25

>>48
/b/ [o]
>>45
/prog/
(  ̄3 ̄)

Name: Anonymous 2009-04-20 19:28

>>47
Didn't you go to /prog/-con 2009? Leah Culver and the ginger were there.

Name: Anonymous 2009-04-20 21:31

>>50
Did they fuck a lot? Was it in public?

Name: Anonymous 2009-04-21 5:58

>>50
/prog/-con 2009
Never heard of it.

Name: Anonymous 2009-04-21 6:00

>>52
You weren't invited. Draw your own conclusions.

Name: Anonymous 2009-04-21 6:22

>>53
Were YOU?

Name: Anonymous 2009-04-21 6:25

>>54
Of course I was. I even bought Xarn a beer.

Name: Anonymous 2009-04-21 6:27

>>55
How did you get invited, then?
You're making me feel left out

Name: Anonymous 2009-04-21 6:28

I had a terrible time at prog-con, I got wasted and exposed myself in front of the Sussman :(

Name: Anonymous 2009-04-21 8:49

>>57
I think he enjoyed it. I saw his snake rise in approval, if you catch my drift.
>>55
James?

Name: Anonymous 2009-04-21 12:49

I talked with Christopher about EMACS and Haskell all the time. In lojban.

Name: Anonymous 2009-04-21 13:49

This thread sucks.

Name: Anonymous 2009-04-21 14:09

Actually, the /prog/ snake is a Python.

Name: Anonymous 2009-04-22 3:53

>>59
roses smell red
violets smell blue
lojban is for fuckwits
that means you

Name: Anonymous 2009-04-22 4:08

>>62
What is the meaning of this? Maybe we could understand you if you could write in Lojban.

Name: Anonymous 2009-04-22 4:49

>>63
Let's say it brings up the question - do roses smell red. I might stop and ponder that for a minute or more and reach an immediate conclusion.

Name: Anonymous 2009-04-22 6:14

>>62
EXPERT SYNESTHETE

Name: Anonymous 2009-04-22 7:40

>>64
Yes, I believe you might.  The rest of us, however, can in a matter of seconds and without interrupting what we were previously doing, remember that in English, the word 'red' describes a colour and not a smell.  Thus, to use this word to describe the experience of molecules from the air stimulating smell receptors in your nose rather than frequencies of light hitting your retina makes little sense outside of discussing the medical condition that Herr >>65 refers to.

Name: Anonymous 2009-04-22 8:36

Not all roses are red.

Name: Anonymous 2009-04-22 8:48

>>66
Wouldn't it be nice to use a language not only syntactically unambigous, like Lojban, but also strongly-typed? I'm thinking along the lines of representing words like ``Red'' as type-qualified, as in ``Coloured-Red'', the same for verbs, ``To See'' would be actually constructed as ``To Perceive-Colour'' (ditto ``...-smell''), correct sentences should be constructed in a type-safe manner: ``to-perceive-colour'' + ``colour-red'' = ``to-perceive-colour-red'' (where colour is still kind of linked to both words it connects), while nonsensical sentences like ``to-perceive-colour-smell-red'' would have obviously wrong grammatical structure.

Name: Anonymous 2009-04-22 8:52

>>68
THIS IS WHAT HASKELLITES ACTUALLY BELIEVE.

Name: Anonymous 2009-04-22 9:02

>>66
colour
Australian detected

Name: Anonymous 2009-04-22 9:14

>>68
WHAt

Name: Anonymous 2009-04-22 18:47

>>68
Couldn't you just say to-perceive-smell-red, and everything would be syntactically dandy, though using the made-up word smell-red? And this requires you to define the categories for words, and there's potentially a whole lot of categories, where not everyone is as clearly delimited as colors. Would some kind of authority sit and name new categories as the need arises?

Name: Anonymous 2009-04-22 18:51

>>68

The only problem with that is that in "seeing" we process motion and object differently beyond the "color" level

It's an integration of two processess

Name: Anonymous 2009-04-22 21:29

>>73
Um, it's RGB not RGBv!!!

Name: Anonymous 2009-04-22 22:20

>>68
It would be about as nice as using a statically typed programming language. I.e. not at all.

Name: Anonymous 2009-04-22 22:59

>>74
You forgot your ROYGBIV

Name: Anonymous 2011-01-31 21:12

<-- check em dubz

Name: 2012-01-25 23:04


Don't change these.
Name: Email:
Entire Thread Thread List