Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 425 426 [427] 428 429 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 884693 times)

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6390 on: September 24, 2014, 03:23:57 pm »

Until Windows ships with Python in the far off year of Never AD, it will always be a problem because it prevents anyone from using your software unless they download Python. That's what executables are for, delivering the experience to everyone on the OS.

http://www.pyinstaller.org/

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6391 on: September 24, 2014, 03:48:40 pm »

http://portablepython.com/
This too.

Granted, including the interpreter makes file size a lot bigger, but that's also becoming much less of a problem as things go on.

...

Relevant to GUNIN, Python books often use "module" and "function" interchangeably. I've no idea why that is.
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6392 on: September 24, 2014, 06:19:57 pm »

People already have to install .Net runtimes, JRE, and others. Why do people treat Python differently? The size would be irrelevant if you had to statically link your runtime of choice anyway.
Logged

alexandertnt

  • Bay Watcher
  • (map 'list (lambda (post) (+ post awesome)) posts)
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6393 on: September 24, 2014, 09:24:19 pm »

People already have to install .Net runtimes, JRE, and others. Why do people treat Python differently?

The problem is people generally don't have to install .NET and JRE, but do Python.

.NET runtimes are preinstalled with Windows. I'm pretty sure they are updated with Windows Update too, so it's pretty much all handled automagically for the end user. Java often comes preinstalled on the OEM installations of Windows that come with computers.

For some software, some people who see instructions beyond "download, doubleclick" will just skip your software entirely. This is particularly true with games, due to the sheer ammount of competition, and the growing ability to run games in the browser without even the "download, doubleclick" step.
Logged
This is when I imagine the hilarity which may happen if certain things are glichy. Such as targeting your own body parts to eat.

You eat your own head
YOU HAVE BEEN STRUCK DOWN!

Squeegy

  • Bay Watcher
  • I don't really have any answers for you.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6394 on: September 24, 2014, 10:22:48 pm »

Until Windows ships with Python in the far off year of Never AD, it will always be a problem because it prevents anyone from using your software unless they download Python. That's what executables are for, delivering the experience to everyone on the OS.

http://www.pyinstaller.org/



It's what I've been using for years to distribute my Python scripts to Windows users. Do you know how pyinstaller works? It packages the entirety of the Python language into an executable (or multiple files, depending on your preferences), and sets it to run your script when it loads. It's quite accurate that they called it pyinstaller because it literally just installs Python for you. The fact that a hack like pyinstaller exists, blessed though its divine creators may be, does not change the fact that Python is fundamentally a scripting language not meant to be compiled. Python did not come with pyinstaller. Python was not meant for pyinstaller. People had to go out and make that for it.

Python users are just fortunate that their executable support is considerably better than Ruby's.

People already have to install .Net runtimes, JRE, and others. Why do people treat Python differently?

The problem is people generally don't have to install .NET and JRE, but do Python.

.NET runtimes are preinstalled with Windows. I'm pretty sure they are updated with Windows Update too, so it's pretty much all handled automagically for the end user. Java often comes preinstalled on the OEM installations of Windows that come with computers.

For some software, some people who see instructions beyond "download, doubleclick" will just skip your software entirely. This is particularly true with games, due to the sheer ammount of competition, and the growing ability to run games in the browser without even the "download, doubleclick" step.

Java is one of the fundamentals of the Internet, like Flash, and there are very few people who are capable of running it that don't have it downloaded. Python is very far from ubiquitous; I would go so far as to say it's rather esoteric.
Logged
I think I'm an alright guy. I just wanna live until I gotta die. I know I'm not perfect, but God knows I try.
Kobold Name Generator
⚔Dueling Blades⚔
Fertile Lands
The Emerald Isles

Orange Wizard

  • Bay Watcher
  • mou ii yo
    • View Profile
    • S M U G
Re: if self.isCoder(): post() #Programming Thread
« Reply #6395 on: September 25, 2014, 01:02:27 am »

I'm confused. What's your point, Squeegy?

We know it's a scripting language. It seems like you're angry for no reason now.

???
Logged
Please don't shitpost, it lowers the quality of discourse
Hard science is like a sword, and soft science is like fear. You can use both to equally powerful results, but even if your opponent disbelieve your stabs, they will still die.

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #6396 on: September 25, 2014, 02:15:57 am »

Relevant to GUNIN, Python books often use "module" and "function" interchangeably. I've no idea why that is.
Ye, prolly the cause of the confusion up there, since the OO book I have does everything from Python.
Logged

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6397 on: September 25, 2014, 03:06:54 am »

Java's typing is admittedly weird. You can't compare two strings together because it will just look at the fact that they are both strings and declare them equal. You have to do "string1.equals(string2)".
I'm pretty sure it's because they're objects and as such the == operator compares the reference address.
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.

Squeegy

  • Bay Watcher
  • I don't really have any answers for you.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6398 on: September 25, 2014, 07:58:24 am »

That is correct, but it doesn't change that it is annoying.
Logged
I think I'm an alright guy. I just wanna live until I gotta die. I know I'm not perfect, but God knows I try.
Kobold Name Generator
⚔Dueling Blades⚔
Fertile Lands
The Emerald Isles

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6399 on: September 25, 2014, 10:41:14 am »

C# specifically makes an exception for strings to avoid this issue. They are technically a reference type under the hood (so copying a string incurs no overhead), but act like a value type for most operations, including comparison (so "hello" == "world" correctly returns false).

This is probably the best way to do it.

In C++, you should avoid using char* (aka C) strings if possible, and use std::string or other wrapper. As of C++14, you can even write "hello"s to create an std::string literal :)
« Last Edit: September 25, 2014, 10:43:08 am by Thief^ »
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Sergius

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6400 on: September 25, 2014, 02:06:57 pm »

C# specifically makes an exception for strings to avoid this issue. They are technically a reference type under the hood (so copying a string incurs no overhead), but act like a value type for most operations, including comparison (so "hello" == "world" correctly returns false).

This is probably the best way to do it.

In C++, you should avoid using char* (aka C) strings if possible, and use std::string or other wrapper. As of C++14, you can even write "hello"s to create an std::string literal :)

I think it's not so much an exception but rather that you can overload operators in C++ / C#. So, what "==" means is entirely up to whoever made the class.

Apparently this is not allowed in Java by design, for some explanation about being confusing to people without the proper context (the class files). Java's "overloaded operators" are not modifiable.
Logged

Thief^

  • Bay Watcher
  • Official crazy person
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6401 on: September 26, 2014, 03:53:54 am »

The rule for languages that allow operator overloading is "the rule of least surprise". That is, overloaded operators should behave as a user would expect them to behave. For example a complex number class is expected to overload +, -, *, ==, etc, and have them perform addition, subtraction, multiplication, equality testing, etc.

C++'s stealing of the bit-shift operators for data streams is a bit dodgy under that rule.
Logged
Dwarven blood types are not A, B, AB, O but Ale, Wine, Beer, Rum, Whisky and so forth.
It's not an embark so much as seven dwarves having a simultaneous strange mood and going off to build an artifact fortress that menaces with spikes of awesome and hanging rings of death.

Sergius

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6402 on: September 26, 2014, 01:59:49 pm »

Well I'd call that rule a Best Practice rather than a rule since there's no way to enforce them.

Cowboy programmers don't care about them rules!
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6403 on: September 26, 2014, 03:32:32 pm »

I can make == be an addition operator! I do what I want!

EnigmaticHat

  • Bay Watcher
  • I vibrate, I die, I vibrate again
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #6404 on: September 26, 2014, 04:56:50 pm »

You're a loose cannon Putman but a damn good programmer.
Logged
"T-take this non-euclidean geometry, h-humanity-baka. I m-made it, but not because I l-li-l-like you or anything! I just felt s-sorry for you, b-baka."
You misspelled seance.  Are possessing Draignean?  Are you actually a ghost in the shell? You have to tell us if you are, that's the rule
Pages: 1 ... 425 426 [427] 428 429 ... 796